美文网首页
mac 无法安装vue-cli

mac 无法安装vue-cli

作者: 子皙丶 | 来源:发表于2020-04-13 23:03 被阅读0次

    1. 无法安装vue-cli

    在网上查的,是因为os版本过高的问题。安装 npm install -g @vue/cli时会出现这个问题

    npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
    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/dove/.npm/_logs/2019-11-14T07_30_27_188Z-debug.log
    

    解决办法:
    在终端输入这个命令

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

    然后再运行npm install -g @vue/cli就可以正常安装了。

    2. 安装vue-cli之后,发现终端并没有vue

    终端输入vue,发现未找到,command not find:vue
    这个问题应该是环境变量没配置,配置一下环境变量

    1. 首先安装一下vue-cli
    sudo npm intall -g vue-cli
    

    就算上面安装了@vue/cli,这个vue-cli也是要安装的
    安装后是这样的


    安装vue-cli
    1. 继续在终端输入export PATH="$PATH:/usr/local/bin/vue",$PATH:后面这个就是上图中标红的
    2. 到此vue就可以正常使用了

    相关文章

      网友评论

          本文标题:mac 无法安装vue-cli

          本文链接:https://www.haomeiwen.com/subject/tyzomhtx.html