这是我的package.json文件:
{
"name": "admin",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Rateb Habedy",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.3",
"gulp": "^4.0.0",
"gulp-autoprefixer": "^6.0.0",
"gulp-clean": "^0.4.0",
"gulp-imagemin": "^5.0.3",
"gulp-minify-css": "^1.2.4",
"gulp-sass": "^4.0.2",
"gulp-uglify": "^3.0.2",
"gulp4-run-sequence": "^0.3.1",
"imagemin-jpeg-recompress": "^6.0.j0",
"imagemin-pngquant": "^7.0.0"
},
"dependencies": {
"del": "^4.0.0",
"gulp-rename": "^1.4.0"
}
}
我只是试图通过这个命令安装(npm - del)包:npm install del --save
之后我无法安装任何包。
它说:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^6.0.j0": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/lion/.npm/_logs/2019-03-05T13_49_41_065Z-debug.log
那有什么解决方案吗?
您遇到的问题不在于npm del package,而是在package.json文件中出现错误,实际上只是一个错字。
看到这一行:
"imagemin-jpeg-recompress": "^6.0.j0",
这不是有效的版本标记,无法解析。您可能希望该行读取:
"imagemin-jpeg-recompress": "^6.0.0",
编辑该行后,您的npm安装应该可以正常工作。