2016-11-21 151 views
0

我測試ionic2和安裝的節點,NPM和科爾多瓦和它一直工作正常。但是,在更新npm後,我無法安裝任何npm軟件包。因此,我根據How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)刪除了所有與node和npm相關的目錄,並重新安裝了node-v6.9.1。但是,這一次再次,當我試圖安裝使用「sudo的NPM安裝-g離子科爾多瓦」科爾多瓦,它給了我一個錯誤:ionic2科爾多瓦安裝錯誤 - ENOENT

$ rm -rf ~/.npm 
$ npm cache clear 
$ sudo npm install -g ionic cordova 
npm WARN deprecated [email protected]: use uuid module instead 
/usr/local/lib 
└── [email protected] 

npm ERR! Darwin 16.1.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ionic" "cordova" 
npm ERR! node v6.9.1 
npm ERR! npm v3.10.8 
npm ERR! path /usr/local/lib/node_modules/.staging/abbrev-ef9cc920 
npm ERR! code ENOENT 
npm ERR! errno -2 
npm ERR! syscall rename 

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/abbrev-ef9cc920' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/abbrev' 
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/abbrev-ef9cc920' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/abbrev' 
npm ERR! enoent This is most likely not a problem with npm itself 
npm ERR! enoent and is related to npm not being able to find a file. 
npm ERR! enoent 

npm ERR! Please include the following file with any support request: 

我一直在#2谷歌搜索和其他的問題,但解決不了問題呢。我正在使用macOS Seira 10.12.1。

這是一個NPM錯誤或我的錯?有沒有可能的解決方案來解決這個問題?

謝謝你幫助我。

回答

0

我不知道如何解決您的問題。但只是一般性建議。在npm install中使用sudo並不是一個好主意。除其他原因之外,它可能會導致安裝惡意節點程序包,這些程序包將能夠在您的計算機上以root用戶權限執行。

此外,NVM(節點版本管理器)可幫助您管理節點安裝。我建議再次刪除所有節點和npm相關的目錄,並按照guide關於安裝節點。然後嘗試再次安裝離子。