MAX安装VUE cli3 报错node_modules permission denied解决方法

376 阅读1分钟

今天在MAC 安装vue cli3的时候遇到了一个报错

WechatIMG33.png

这是报错信息 然后在百度搜索解决方法 在终端输入

sudo chown -R $(whoami) /usr/local/*

可以顺利解决这个问题 在解决这个问题之后 我又运行了安装命令 结果最后安装又提示报错 跟上次的报错是不同的

npm ERR! code EEXIST
npm ERR! path /usr/local/bin/vue
npm ERR! EEXIST: file already exists
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:
npm ERR!     /Users/mac/.npm/_logs/2021-12-13T09_03_21_930Z-debug.log
mac@gjr ~ % cd  /Users/mac/Desktop/vue 
mac@gjr vue % vue  create vue_test

  vue create is a Vue CLI 3 only command and you are using Vue CLI 2.9.6.
  You may want to run the following to upgrade to Vue CLI 3:

  npm uninstall -g vue-cli
  npm install -g @vue/cli

在搜索查找以后 是因为安装的VUE版本过低 尝试使用下面的命令

npm uninstall -g vue-cli

是不生效的 使用强制覆盖命令就可以了

npm install -g @vue/cli --force