鍍金池/ 問答/HTML5  Linux  HTML/ Ubuntu安裝angular失敗,一直卡在uglifyjs-webpack-p

Ubuntu安裝angular失敗,一直卡在uglifyjs-webpack-plugin@0.4.6

圖片描述

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
求大神解答疑惑!

回答
編輯回答
萌吟

sudo 權(quán)限不夠~~~
有些文件夾是只有system才能進(jìn)行讀寫~~

可以嘗試下在自己的文件夾"home/:username"跑 npm install angular@cli;
之后使用ln 鏈接到/usr/bin;
應(yīng)該就可以全局運(yùn)行了

2017年12月24日 16:11
編輯回答
久礙你

之前 CentOS 上安裝 webpack 時(shí)也出現(xiàn)了這個(gè)錯誤。最后用 yarn 代替 npm 解決了。
https://yarnpkg.com/en/docs/install#linux-tab
你可以嘗試一下。

2017年8月31日 06:44