我想安装webpack,但是它给了我一个错误:webpack-cli@3.2.1 postinstall: lightercollective
。如何成功安装它?
我想安装webpack,但是它给了我一个错误:webpack-cli@3.2.1 postinstall: lightercollective
。如何成功安装它?
首先,您需要验证是否安装了最新版本的Node.js和npm?
node -v / npm -v
看起来你只全局安装了webpack而没有安装webpack-cli,或者反过来。
请全局安装webpack和webpack-cli。
npm uninstall -g webpack webpack-cli
npm install -g webpack webpack-cli
我们现在在webpack-cli
中不再使用lightercollective
。您现在不应该遇到此问题。只需将webpack-cli
升级到最新版本即可。
$ npm install webpack webpack-cli
,但输出为:sh: lightercollective: command not found, npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! webpack-cli@3.2.1 postinstall: lightercollective npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the webpack-cli@3.2.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
- Martin Sonnpm install lightercollective && npm install webpack webpack-cli
。问题在于您没有安装 lightercollective。错误可能来自 webpack 的 post-install 钩子。希望如果您先安装 lightercollective,问题就会消失。 - Lars Nyström