2017-01-16 171 views
0

我已安裝離子並正常運行。 一不留神我安裝了beta版意外重新安裝後無法安裝或運行Ionic

npm install [email protected] 

我這樣做,而不必用CMD管理員身份運行,沒有被再確認,離子命令後,所以我試圖重新安裝離子,但沒有運氣,我試圖卸載它,然後再次而且安裝它沒有運氣,我得到的錯誤,當我安裝它:

npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\{user}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic" 
npm ERR! node v6.9.4 
npm ERR! npm v4.1.1 
npm ERR! path C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d 
npm ERR! code ENOENT 
npm ERR! errno -4058 
npm ERR! syscall rename 

npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi' 
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi' 
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. 

回答

1

的問題是,因爲沒有管理員權限,安裝後測試版本,它創建了用戶範圍PATH變量指向只有NPM目錄,而這個變量覆蓋了系統PATH變量,所以CMD使用了用戶範圍一,導致離子安裝失敗。

刪除用戶的範圍PATH變量並重新安裝離子修復了問題。