如何更正此错误?找不到usemin

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

我尝试安装rimraf,复制文件,imagemin,usemin-cli,cssmin,uglifyjs和htmlmin之后运行npm run build。然后编辑package.json文件。但我得到了错误

sh:1:usemin:未找到

这是我的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": "npx node-sass -o css/ css/",
    "watch:scss": "npx onchange 'css/*.scss' -- npm run scss",
    "watch:all": "concurrently 'npm run watch:scss' 'npm run lite'",
    "clean": "node_modules/rimraf/bin.js dist",
    "copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
    "imagemin": "imagemin img/* --out-dir='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.3.0",
    "node-sass": "^4.7.2",
    "onchange": "^3.3.0",
    "parallelshell": "^3.0.1",
    "rimraf": "^2.6.2",
    "uglifyjs": "^2.4.11",
    "usemin-cli": "^0.5.1"
  },
  "dependencies": {
    "bootstrap": "^4.4.1",
    "bootstrap-social": "^5.1.1",
    "font-awesome": "^4.7.0",
    "jquery": "^3.4.1",
    "popper.js": "^1.12.9"
  }
}

尝试过Google,但未找到任何内容。我正在使用ubuntu

node.js web-deployment web-development-server web-frontend npm-scripts
1个回答
0
投票

我认为npm无法读取路径。

我添加了路径

node_modules / .bin / usemin

代替上面脚本中的usemin。

有效。

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