安装 npm 版本 3.10.9 失败
failed install npm version 3.10.9
我运行npm i -g npm@3.10.9
然后它说
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/fs-write-stream-atomic/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/move-concurrently/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
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! /home/herdyan/.npm/_logs/2020-07-09T03_08_01_073Z-debug.log
是不是因为当我用 npm list -g --depth=0
检查时我已经有了 npm@6.14.6
由于我是这个 npm-install 的新手,我仍然不知道如何解决它,感谢@Mateen 所以我决定将 sudo
放入 sudo npm i -g npm@3.10.9
您可能以 root 身份或使用 sudo 安装了 NodeJS。发生这种情况时,您需要拥有 install/update npm 和其他任何东西的超级用户权限。
理想情况是在用户 space 中安装 NodeJS,最好使用 NVM,这样您就可以安装许多不同版本的 NodeJS,并且可以轻松地从一个版本切换到另一个版本。
我运行npm i -g npm@3.10.9
然后它说
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/fs-write-stream-atomic/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/move-concurrently/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
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! /home/herdyan/.npm/_logs/2020-07-09T03_08_01_073Z-debug.log
是不是因为当我用 npm list -g --depth=0
检查时我已经有了 npm@6.14.6由于我是这个 npm-install 的新手,我仍然不知道如何解决它,感谢@Mateen 所以我决定将 sudo
放入 sudo npm i -g npm@3.10.9
您可能以 root 身份或使用 sudo 安装了 NodeJS。发生这种情况时,您需要拥有 install/update npm 和其他任何东西的超级用户权限。
理想情况是在用户 space 中安装 NodeJS,最好使用 NVM,这样您就可以安装许多不同版本的 NodeJS,并且可以轻松地从一个版本切换到另一个版本。