简体   繁体   中英

Having a problem with npm global install on MacOS 11.6.1 with M1 chip

I'm trying to install npm in the terminal and I keep getting err messages.

The command is

`npm install -g ts-node` 

and this is the err return

npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/ts-node/dist/bin-script-deprecated.js
npm ERR! dest /usr/local/bin/ts-script
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/ts- 
node/dist/bin-script-deprecated.js' -> '/usr/local/bin/ts-script'
npm ERR!  [Error: EACCES: permission denied, symlink '../lib/node_modules/ts- 
node/dist/bin-script-deprecated.js' -> '/usr/local/bin/ts-script'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/ts-node/dist/bin-script-deprecated.js',
npm ERR!   dest: '/usr/local/bin/ts-script'
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/aj/.npm/_logs/2021-11-10T21_41_24_060Z-debug.log

npm has an entire web page specifically on how to resolve the issue of EACCES errors when installing packages globally . Find all the details there. They suggest many possible solutions. The one I would recommend, especially since you are presumably having this issue on a development machine, is to use a version manager like nvm instead of whatever package or whatever you used to install Node.js on your machine. But check the aforementioned web page for other options.

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