[英]Cordova installation error: path issue (?) - error code ENOENT
安裝Xcode和NodeJS之后我現在正在嘗試安裝Cordova,但是我收到了關於丟失文件的錯誤(錯誤的路徑?)。
Luciens-MacBook-Pro:~ lucientavano$ npm cache clean
Luciens-MacBook-Pro:~ lucientavano$ sudo npm install -g cordova
Password:
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/lib
└── (empty)
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! node v4.2.6
npm ERR! npm v3.6.0
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:
npm ERR! /Users/lucientavano/npm-debug.log
npm ERR! code 1
Luciens-MacBook-Pro:~ lucientavano$ tail -10 /Users/lucientavano/npm-debug.log
21365 error npm v3.6.0
21366 error path /usr/local/lib/node_modules/.staging/abbrev-ef9cc920
21367 error code ENOENT
21368 error errno -2
21369 error syscall rename
21370 error 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'
21371 error 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'
21371 error enoent This is most likely not a problem with npm itself
21371 error enoent and is related to npm not being able to find a file.
21372 verbose exit [ -2, true ]
你遇到過類似的問題嗎? 如果您有任何建議,請提前感謝您。
卸載cordova然后安裝它對我有用。
cd /usr/local/lib/node_modules/
sudo npm uninstall -g cordova
sudo npm install -g cordova
使用YARN解決它
sudo npm install -g yarn
yarn install -g cordova
我和其他包有過同樣的問題。 我不得不從這里重新安裝節點https://nodejs.org/en/download/ 。 對我來說,當我嘗試在沒有sudo的情況下全局安裝軟件包時,或者當我用ctrc + c取消某些安裝包安裝過程時,就發生了這種情況。 之后,沒有辦法解決它,但重新安裝節點。 我也在Mac上,現在非常小心讓npm做它的工作......
我在Fedora Core 22上發現了這個問題,當安裝最新的Apache Cordova(版本6.0.0)時,問題可能會在安裝sudo npm install -g cordova
時錯過關於權限檢查的問題。
npm ERR! enoent ENOENT, rename '/lib/node_modules/.staging/abbrev-cxxxxxx'
npm ERR! enoent ENOENT, rename '/lib/node_modules/.staging/abbrev-xxxxxxx'
因此,以root身份運行( sudo -s
)並再次運行npm install -g cordova
解決此問題,問題將解決。 (在我的環境中)。
對於我的環境(Fedora core 22),它不需要從nodejs.org重新安裝節點
首先卸載cordova: npm uninstall -g cordova
重新安裝cordova npm install -g cordova
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.