mac安装npm|mac安装npm install -g @vue/cli报错解决
下午在mac上安装Vue Cli官网给的命令npm install -g @vue/cli时报错,如下:
yanxudeMacBook-Pro:vue3 dove$ 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 $USER /usr/local解决,但是出现下面的报错:
chown: /usr/local: Operation not permitted
查了下原因是因为这种方法对于高版本的OS来说,是解决不了的,在评论中发现大佬回复解决问题,解决代码如下:
sudo chown -R $(whoami) /usr/local/*
【mac安装npm|mac安装npm install -g @vue/cli报错解决】
附大佬截图
文章图片
image.png
推荐阅读
- Mac安装Chromedriver
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- MAC安装Mongo
- 如何在Mac中的文件选择框中打开系统隐藏文件夹
- 【Hadoop踩雷】Mac下安装Hadoop3以及Java版本问题
- 机器学习|机器学习 Andrew Ng《Machine Learning》课程笔记1
- react|react 安装
- VueX--VUE核心插件
- python-安装sublime遇到异常
- typeScript入门基础介绍