@ angular / cli 4不会安装在debian上

时间:2017-09-29 04:00:20

标签: javascript node.js linux angular debian

所以我无法在我的debian盒子上安装@ angular / cli。我有最新的nodejs,并安装了npm。我的Windows机器上的Angular4正常运行,我每天都使用它。我的数字海洋水滴。我无法让它运行。我已经尝试了我能想到的一切。我尝试了一系列修复,最新的问题是这个。我试图更改npm安装目录,以root用户身份重新安装。我能想到的一切。继承人宣读了

root@gentest:/var/site# npm install @angular/cli -g
/root/.npm-global/bin/ng -> /root/.npm-global/lib/node_modules/@angular/cli/bin/ng

> node-sass@4.5.3 install /root/.npm-global/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/root/.npm-global/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:502:3

> uglifyjs-webpack-plugin@0.4.6 postinstall /root/.npm-global/lib/node_modules/@angular/cli/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/root/.npm-global/lib/node_modules/@angular/cli/node_modules/uglifyjs-webpack-plugin/lib/post_install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:502:3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.5.3 (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.5.3 install: `node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
npm ERR! Exit status 1
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-09-29T03_48_38_150Z-debug.log
root@gentest:/var/site#

当我尝试运行服务-o时 在我的angular4应用程序中它说:

  

NG Live Development Server正在侦听localhost:4200,打开你的   浏览器http://localhost:4200 10%构建模块3/3模块0   active(node:12295)UnhandledPromiseRejectionWarning:未处理的promise   rejection(拒绝id:1):错误:退出代码3

非常感谢任何帮助。三江源

1 个答案:

答案 0 :(得分:0)

首先删除node_modlues文件夹

然后首先尝试:

使用以下内容安装:sudo

sudo npm install @angular/cli -g

在大多数情况下,它有效,如果不起作用,请尝试使用此

sudo npm install @angular/cli -g --unsafe-perm