Issue
When I run ~$ npm install -g typescript
The following message shows:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/typescript
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/typescript'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/typescript'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/typescript'
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/alexz/.npm/_logs/2021-12-26T10_45_08_412Z-debug.log
and i tried to check if I have successfully installed typescript, if I run npm ls typescript
it shows:
alexz@ /Users/alexz
└── typescript@4.5.4
I am confused if I have installed typescript or not, because if I do tsc -v it tells me the tsc command is not found.
How do I fix the above problem? Thanks.
Solution
It is a permission issue. Use sudo
command, it will ask you your computer password.
sudo npm install -g typescript
Answered By - yousoumar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.