root@xiangdong-virtual-machine:/home/xiangdong# sudo npm i -g @angular/cli
/root/tools/node-v8.9.3-linux-x64/bin/ng -> /root/tools/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/bin/ng
node-sass@4.7.2 install /root/tools/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/node-sass
node scripts/install.js
sh: 1: node: Permission denied
uglifyjs-webpack-plugin@0.4.6 postinstall /root/tools/node-v8.9.3-linux-x64/lib/node_modules/@angular/cli/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
node lib/post_install.js
sh: 1: node: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 install: node scripts/install.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: node lib/post_install.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-12-20T10_31_29_596Z-debug.log
求大神解答疑惑!
之前
CentOS
上安装webpack
时也出现了这个错误。最后用yarn
代替npm
解决了。https://yarnpkg.com/en/docs/install#linux-tab
你可以尝试一下。