【问题标题】:@angular/cli 4 wont install on debian@angular/cli 4 不会安装在 debian 上
【发布时间】:2017-09-29 04:00:20
【问题描述】:

所以我无法在我的 debian 机器上安装 @angular/cli。我安装了最新的 nodejs,并安装了 npm。我的 Angular4 在我的 Windows 机器上运行良好,我每天都在使用它。我的数字海洋水滴。我无法让它运行。我已经尝试了我能想到的一切。我已经尝试了一系列修复,最新的问题是这个。我试图更改 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#

当我尝试运行 ng serve -o 在我的 angular4 应用程序中它说:

NG Live Development Server 正在监听 localhost:4200,打开你的 http://localhost:4200 上的浏览​​器 10% 构建模块 3/3 模块 0 活动(节点:12295)UnhandledPromiseRejectionWarning:未处理的承诺 拒绝(拒绝 id:1):错误:以代码 3 退出

任何帮助将不胜感激。谢谢你

【问题讨论】:

    标签: javascript node.js linux angular debian


    【解决方案1】:

    首先删除node_modlues文件夹

    然后首先尝试:

    安装它:sudo

    sudo npm install @angular/cli -g
    

    在大多数情况下它可以工作,如果它不起作用,那么试试这个

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

    【讨论】:

    • 安装不安全,但我仍然得到,** NG Live Development Server 正在侦听 localhost:4200,在 localhost:4200 上打开浏览器 ** 10% 构建模块 3/3 模块0 active(node:15876) UnhandledPromiseRejectionWarning: UnhandledPromiseRejectionWarning: Unhandled Promise Rejection (rejection id: 1): Error: Exited with code 3 92% chunk asset optimizationKilled
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 2018-06-23
    • 2019-08-04
    • 2017-12-18
    • 1970-01-01
    相关资源
    最近更新 更多