[英]babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none was installed
[英]babel-preset-es2016 requires a peer of babel-runtime but none was installed
我意识到npm不再安装对等依赖项,但是当我手动安装时,为什么仍然收到警告?
➜ npm install babel-runtime -g
/usr/local/lib
└─┬ babel-runtime@6.6.1
└── core-js@2.2.1
➜ npm install babel-preset-es2016 -g
/usr/local/lib
├── babel-preset-es2016@6.0.8
└── UNMET PEER DEPENDENCY babel-runtime@^6.6.1
npm WARN babel-preset-es2016@6.0.8 requires a peer of babel-runtime@^6.6.1 but none was installed.
编辑
如果我在本地安装(按照以下建议),则不会收到警告:
➜ test npm i babel-runtime@\^6.6.1
test@1.0.0 /home/jdifool/work/test
├── babel-preset-es2016@6.0.8
├── babel-runtime@6.6.1
└─┬ babelify@7.2.0
└─┬ babel-core@6.7.4
├─┬ babel-code-frame@6.7.4
│ └── babel-runtime@5.8.38
├─┬ babel-generator@6.7.2
│ └── babel-runtime@5.8.38
├─┬ babel-helpers@6.6.0
│ └── babel-runtime@5.8.38
├─┬ babel-messages@6.7.2
│ └── babel-runtime@5.8.38
├─┬ babel-register@6.7.2
│ └─┬ babel-runtime@5.8.38
│ └── core-js@1.2.6
├── babel-runtime@5.8.38
├─┬ babel-template@6.7.0
│ └── babel-runtime@5.8.38
├─┬ babel-traverse@6.7.4
│ └── babel-runtime@5.8.38
├─┬ babel-types@6.7.2
│ └── babel-runtime@5.8.38
└─┬ babylon@6.7.0
└── babel-runtime@5.8.38
为什么?
这很冗长。 只需安装所需的软件包
$ npm i babel-runtime@^6.6.1 -g
因为您的预设也在全局范围内,所以请在全局范围内安装,然后重试。
更新 (通过@JohnDifool进行):似乎仅针对全局安装显示警告。
当我遇到此问题时,可以通过更新npm,清除npm缓存,然后再次运行npm install
命令来解决。 但是,正如我将详细说明的那样,在此过程中存在一些问题。
首先,我尝试使用npm update -g npm
,但这引发了错误:
npm ERR! addLocal Could not install /private/var/folders/_n/vgvdlrpj64l_g98d_dxs5pd40000gp/T/npm.80873/package
我可以使用命令npm install -g npm@latest
来成功更新, 如GitHub用户bronziii所建议 。
npm install
之前进行清理 rm -rf node_modules
npm cache clean
npm install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.