【发布时间】:2020-05-17 17:29:23
【问题描述】:
我在安装 rimraf、copyfiles、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"
}
}
尝试了谷歌,但没有找到任何东西。我正在使用 ubuntu
【问题讨论】:
-
尝试运行
npm install,它将添加你的 package.json 文件中的所有包。看起来你还没有安装usemin这与你已经安装的usemin-cli不同 -
试过了,没用。
-
哦,我看错了,我以为我看到
usemin是usemin-cli的一个单独的包。棘手的一个,您是否尝试过将脚本从usemin重命名为其他名称,这可能是与包名冲突的问题? -
是的,我试过了。
标签: node.js web-deployment web-development-server web-frontend npm-scripts