简体   繁体   中英

installing yarn globally on mac

i have an Imac and i tried installing yarn globally with npm and i got these error:

npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/yarn
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/yarn'
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:
npm ERR!     /Users/user/.npm/_logs/2021-12-01T13_55_41_980Z-debug.log

I have tried sudo but it requires a password and note that this is a new system and does not have any passwords set, i have researched to see if there are similar problems but haven't found any. If you do have a solution to this problem i would really appreciate it if you help me out and solve this. Thank you..

can you try to use a blank password?

UNIX bases systems always have a root user and they tend to have no password, when it was set first. So when the console is asking you for a password, just press ENTER.

The error even says that you have insufficient permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM