npm为bootstrap4 UI Framework Web项目运行构建错误

问题描述 投票:0回答:2

我需要一些帮助。

在我输入npm run build到我的Windows 10终端后,我收到以下错误:

'imagemin'不被识别为内部或外部命令,可操作程序或批处理文件。错误的ERR!代码ELIFECYCLE npm ERR!错误1 npm ERR! [email protected] imagemin:imagemin img/* -o dist/img npm ERR!退出状态1 npm ERR!错误的ERR!在[email protected] imagemin脚本失败。错误的ERR!这可能不是npm的问题。上面可能有额外的日志记录输出。错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\ Users \ ndunga \ AppData \ Roaming \ npm-cache_logs \ 2017-10-19T16_46_04_328Z-debug.log npm ERR!代码ELIFECYCLE npm ERR!错误1 npm ERR! [email protected] build:npm run clean && npm run copyfonts && npm run imagemin && npm run usemin npm ERR!退出状态1 npm ERR!错误的ERR!在[email protected]构建脚本失败。错误的ERR!这可能不是npm的问题。上面可能有额外的日志记录输出。错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\ Users \用户ndunga \应用程序数据\漫游\ NPM-cache_logs \ 2017-10-19T16_46_04_381Z-的debug.log

这是我的package.json文件

{
  "name": "confusion",
  "version": "1.0.0",
  "description": "This is a website for Ristorante Con Fusion",
  "main": "index.html",
  "scripts": {
    "start": "npm run watch:all",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "scss": "node-sass -o css/ css/",
    "watch:scss": "onchange \"css/*.scss\" -- npm run scss",
    "watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\"",
    "clean": "rimraf dist",
    "copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
    "imagemin": "imagemin img/* -o dist/img",
    "usemin": "usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html",
    "build": "npm run clean && npm run copyfonts && npm run imagemin && npm run usemin"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "cssmin": "^0.4.3",
    "htmlmin": "0.0.7",
    "lite-server": "^2.2.2",
    "node-sass": "^4.5.3",
    "onchange": "^3.2.1",
    "parallelshell": "^3.0.2",
    "rimraf": "^2.6.2",
    "uglifyjs": "^2.4.11",
    "usemin-cli": "^0.5.1"
  },
  "dependencies": {
    "bootstrap": "^4.0.0-alpha.6",
    "font-awesome": "^4.7.0"
  }
}
deployment npm build npm-scripts
2个回答
0
投票

您没有安装imagemin软件包。

npm install imagemin --save

0
投票

安装imagemin-cli并在"imagemin": "imagemin img/ --out-dir=dist/img"中像package.json一样使用它

© www.soinside.com 2019 - 2024. All rights reserved.