LoginSignup
3
0

More than 3 years have passed since last update.

Vue CLIインストール時のエラー(EEXIST: file already exists, symlink ~)

Last updated at Posted at 2020-07-07

エラー発生状況

nodeバージョン:v12.16.3
npmバージョン:6.14.4

Vue CLIをインストールするため

npm install -g @vue/cli

を実行したところ、

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
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!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
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.

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

と怒られた。

どうやらアクセス権限を拒否されたみたいなので、
コマンドの先頭にsudoをつけて

sudo npm install -g @vue/cli

を実行したところ、

npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/@vue/cli/bin/vue.js
npm ERR! dest /usr/local/bin/vue
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/@vue/cli/bin/vue.js' -> '/usr/local/bin/vue'
npm ERR! File exists: /usr/local/bin/vue
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

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

と、さっきとは違うエラーが出た。

解決策

symlinkがどうちゃらこうちゃらなってるみたいなので色々ググって解決策を試してみたのですが一向に直らず。
でもnpmがおかしいんだろうなとは思っていたのでとりあえず

npm install -g npm

でnpmをアップデートし、
再度sudo無しで

npm install -g @vue/cli

を実行したところ、
なんとインストールできました。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0