NPM因尝试安装软件包并使用--save标志而崩溃

时间:2019-03-05 14:10:23

标签: npm gulp del

这是我的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

有什么解决办法吗?

1 个答案:

答案 0 :(得分:1)

您遇到的问题不是npm del软件包,而是package.json文件中的一个错误,实际上只是一个错字。

查看行:

"imagemin-jpeg-recompress": "^6.0.j0",

这不是有效的版本标记,因此无法解析。您可能希望该行显示为:

"imagemin-jpeg-recompress": "^6.0.0",

一旦您修改了该行,您的npm安装便会正常工作。