簡體   English   中英

Vue-Cli 不會安裝

[英]Vue-Cli won't install

我有節點 11.2.0

繼續收到此錯誤。

Andrews-MacBook-Pro:vueTutorial aharris$ npm install -g @vue/cli
npm WARN deprecated hoek@5.0.4: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN @apollographql/apollo-upload-server@5.0.3 requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aharris/.npm/_logs/2018-11-25T18_43_42_502Z-debug.log

您正面臨文件權限的問題。

npm-g參數表示“全局”,它將這些文件安裝在系統目錄中,特別是在您的計算機/usr/local/lib/node_modules中,其中所有者可能是root並且具有權限rwxr-xr-x ,表示那些非root將無權寫入。

然后,您可以使用sudo來獲得此權限,或者就像NPM 模塊不會在沒有 sudo 的情況下全局安裝一樣,將 npm 前綴設置為您擁有權限的路徑:

$ npm config set prefix '~/.npm-packages'

您需要做的就是在它之前使用 sudo 運行相同的命令,

sudo npm install -g @vue/cli

系統會提示您輸入管理員密碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM