首页 > 安装npm时出错:refusing to install grunt as a dependency of itself

安装npm时出错:refusing to install grunt as a dependency of itself


打开 package.json 删除 里面 关于 grunt的信息


我装webpack的时候也出现了这个问题

Refusing to install webpack as a dependency of itself

当时我的package.json是这个样子的

{
  "name": "webpack",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {

  }
}

然后我把name字段改成webpacktest就好了,没错!就好了,太神奇了

{
  "name": "webpacktest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^3.9.1",
    "webpack": "^1.13.0"
  }
}


网络不好网络不好网络不好


没错,package.json文件的name名字不能跟npm模块相同。

【热门文章】
【热门文章】