1

当我执行 npm i -g typescript typescript-language-server 这是终端返回的内容并且不安装语言

npm WARN checkPermissions Missing write access to /usr/local/lib<br>
npm WARN notsup Unsupported engine for fs-extra@10.0.0: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})<br>
npm WARN notsup Not compatible with your version of node/npm: fs-extra@10.0.0<br>

npm ERR! code EACCES<br>
npm ERR! syscall access<br>
npm ERR! path /usr/local/lib<br>
npm ERR! errno -13<br>
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'<br>
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']<br>
npm ERR!   stack:<br>
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib\'',<br>
npm ERR!   errno: -13,<br>
npm ERR!   code: 'EACCES',<br>
npm ERR!   syscall: 'access',<br>
npm ERR!   path: '/usr/local/lib' }<br>
npm ERR! <br>
npm ERR! The operation was rejected by your operating system.<br>
npm ERR! It is likely you do not have the permissions to access this file as the current user<br>
npm ERR!<br> 
npm ERR! If you believe this might be a permissions issue, please double-check the<br>
npm ERR! permissions of the file and its containing directories, or try running<br>
npm ERR! the command again as root/Administrator.<br>

npm ERR! A complete log of this run can be found in:<br>
npm ERR!     /home/alfredo/.npm/_logs/2021-07-29T22_20_46_385Z-debug.log'<br>
4

1 回答 1

0

这是一个权限错误,这意味着您没有对/usr/local/lib文件夹的写入权限。

解决它。运行此命令:

sudo chown -R $USER /usr/local/lib

于 2021-07-30T13:23:56.117 回答