vue 安裝失敗

本人在安裝vue腳手架時報這樣的錯,我訪問了漫山遍野還是沒找到答案,有人叫我用cnpm安裝,但是cnpm安裝的vue有好多坑在裏面:

?

1

2

3

4

5

6

7

8

9

10

11

npm WARN checkPermissions Missing write access to C:\Users\liuyg\AppData\Roaming\npm\node_modules\vue-cli\node_modules\cliui\node_modules\wordwrap

npm ERR! path C:\Users\liuyg\AppData\Roaming\npm\node_modules\vue-cli\node_modules\cliui\node_modules\wordwrap

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! syscall access

npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\liuyg\AppData\Roaming\npm\node_modules\vue-cli\node_modules\cliui\node_modules\wordwrap'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

 

npm ERR! A complete log of this run can be found in:

npm ERR!   C:\Users\liuyg\AppData\Roaming\npm-cache\_logs\2017-10-18T14_34_23_721Z-debug.log

 

 

於是我在繼續翻貼發紅包,終於找到解決方案了,貌似是網絡代理問題

換一個npm安裝源就好了,具體步驟方法如下:

首先我們要先不管有沒有原來的老vue2.0,都先清除一遍

1.npm uninstall vue-cli -g 或 yarn global remove vue-cli

在卸載的時候可能會發生卸載不掉的情況,這是npm源問題,可以通過npm換源:npm config set registry https://registry.npmjs.org

然後可以使用下列任一命令來安裝新版本 npm install -g @vue/cli 或 yarn global add @vue/cli。這裏node版本必須在8.9 或更高版本,可以通過node -v檢測,如果低於8.9可去官網下載,然後

1.通過config命令

?

1

npm config set registry https://registry.npm.taobao.org

npm info underscore (如果上面配置正確這個命令會有字符串response)

 

 

2.命令行指定

?

1

npm --registry https://registry.npm.taobao.org info underscore

然後再安裝就好了

 

 

注意: 這裏在安裝的時候可能會安裝的特別慢或者安裝不下來的情況,這裏可以用cnpm去安裝:
1.先導入cnpmnpm install -g cnpm --registry=https://registry.npm.taobao.org
2.安裝@vue/clicnpm install -g @vue/cli。(網上有說安裝vue-cli 3.0及以上版本不能使用cnpm,只能使用npm,em....這點我也不太清楚)

然後通過vue -V檢測版本是否在3.0及以上,之後就是該咋辦咋辦了

 

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持我。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章