2017-06-02 63 views
0

我在AWS上有一個Ubuntu實例,我使用僞造來設置服務器。 我已經安裝了包nodejs和npm。 爲了解決在Ubuntu上安裝全球包我按照本教程中提到的第二個解決方案的問題, https://docs.npmjs.com/getting-started/fixing-npm-permissions在Ubuntu服務器上從npm安裝@ angular/cli

現在,當我嘗試使用這個命令來安裝,

NPM安裝-g @angular/CLI

我碰到下面的錯誤,

[email protected]:~/frontend/current$ npm install -g @angular/cli 

▐╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ WARN引擎@ angular/cli @ 1.1.0:wanted:{「node」:「> = 6.9.0」,「npm」:「> = 3.0.0」}(current:{「node」:「4.2.6」,「npm」:「 3.5.2「}) loadDep:node-sass→heade▌███████████████████████░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░ loadDep:node-sass→resol████████████████████████░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:node-sass→mapTo▀█████████████████ ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:節點-sass→在████████████████████████之後░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:@ ngtools/json-sch████████████████ █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep :yargs→200▌██████████████████████████████████████████░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░ ░░░░░░░░░╟ /home/forge/.npm-global/bin/ng - > /home/forge/.npm-global/lib/node_modules/@angular/cli/bin/ng

[email protected]安裝/home/forge/.npm-global/lib/node_modules/@angular/cli/node_modules/node-sass 節點腳本/ install.js

SH :1:節點:未找到 npm WARN安裝:[email protected] [email protected]安裝:node scripts/install.js npm WARN安裝:[email protected]產卵ENOENT /home/forge /。 npm-global/lib └─┬@a ngular/[email protected] └──未滿足可選依賴[email protected]^4.3.0

NPM WARN可選跳躍失敗可選依賴/ @角/ CLI/chokidar/fsevents: NPM WARN notsup不兼容您的操作系統或體系結構:[email protected]

+1

清除所有相關的node_modules,cache,appdata,然後重新安裝nodejs。以「sudo」用戶身份登錄。使用命令'sudo npm install ...' – Aravind

回答

0

運行下面的命令

sudo apt-get uninstall nodejs 

sudo apt-get install python-software-properties 
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - 

sudo apt-get install nodejs 

現在,使用檢查點/ NPM版本

node -v 
npm -v 

然後嘗試安裝CLI。

+1

'sudo apt-get卸載nodejs'返回'E:無效的操作卸載',正確的命令是我想''sudo apt-get --purge remove nodejs' – Padhraic

0

我們可以使用紗包管理器。它的快速,簡單,易懂(有意義)。您可以:

  1. 安裝紗

    NPM安裝紗-g

  2. 使用紗安裝角CLI

yarn global add angular-cli

完成這就是它,它的工作爲了我。

0

我有一個類似的問題這一點,問題是由我的版本節點安裝的4.7.2,而不是新的6.x的版本as per this question引起的。所以我安裝了angular-cli而不是this answer suggested

如果您已經安裝@angular/cli,你需要NodeJS更高 6.9.7,連同NPM 或更高。

如果您已經安裝angular-cli,則需要更高的NodeJS4.4.x到,連同NPM 或更高。

欲瞭解更多信息,請參閱上面的鏈接並閱讀必備條件。