vue-cli npm安装错误。 ELIFECYCLE ENOENT产生protobufjs

时间:2018-10-26 22:48:33

标签: node.js spawn npm-scripts vue-cli-3

我正在尝试按照给定的说明安装 vue-cli 3

   npm install -g @vue/cli

环境:

WSL
Ubuntu 18
Node 8.12.0
npm 6.4.1
"n" node version manager

看来问题出在child_process.spawn 后安​​装脚本

使用的节点protobufjs@6.8.8

请参见: child_process.spawn不适用于Windows github.com/nodejs/node/issues/3675上的npm运行脚本

问题 是否有一种方法可以阻止该postinstal脚本运行并允许其余的安装,而我可以稍后以某种方式手动运行postinstall?

这是错误:

stack Error: protobufjs@6.8.8 postinstall: `node scripts/postinstall`
stack spawn ENOENT
stack     at ChildProcess.<anonymous> (/root/n/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
stack     at emitTwo (events.js:126:13)
stack     at ChildProcess.emit (events.js:214:7)
stack     at maybeClose (internal/child_process.js:915:16)
stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
pkgid protobufjs@6.8.8
cwd /mnt/c/Users/dogbot
Linux 4.4.0-17134-Microsoft
argv "/root/n/bin/node" "/root/n/bin/npm" "install" "-g" "@vue/cli"
node v8.12.0
npm  v6.4.1
@6.8.8 postinstall: `node scripts/postinstall`
error spawn ENOENT
error Failed at the protobufjs@6.8.8 postinstall script.
error This is probably not a problem with npm. There is likely additional logging output above.

1 个答案:

答案 0 :(得分:0)

我使用了ignore-scripts标志

npm install  @vue/cli -g --ignore-scripts

然后我对protobufjs做同样的事情

npm install protobufjs  -g --ignore-scripts

最后,我手动运行了protobufjs安装后脚本

node ~/n/lib/node_modules/protobufjs/bin/scripts/postinstall.js

我的安装现在似乎可以正常工作。