如何在 ubuntu 20.04.1 LTS 上安装 yeoman 命令行工具?
How can i install yeoman command line tool on ubuntu 20.04.1 LTS?
我尝试在 Ubuntu 20.04.1 LTS 中安装 yeoman 命令行工具用于 ASP.NET 核心 Web 应用程序开发。输入后
npm install -g yo
在终端中,我收到一个错误。
错误描述如下。
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
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/shashankshekhar/.npm/_logs/2020-12-21T11_02_14_859Z-debug.log```
全局模块安装的 EACCES
错误问题非常普遍,以至于 npm
有 an entire web page dedicated to solving just this issue。
因为你正在安装 yeoman,我想这是一台开发机器。在这种情况下,最好的选择可能是使用 nvm
.
这样的包管理器安装 node
/npm
你不想做但人们经常建议的一件事是运行将npm
命令与sudo
结合起来.人们推荐它是因为它简单。但是如果你这样做,你正在安装的任何依赖项的所有生命周期脚本(例如 postinstall
)也将是 运行 作为 root
。这可能是 lot 不受信任的代码 运行ning 作为 root
.
我尝试在 Ubuntu 20.04.1 LTS 中安装 yeoman 命令行工具用于 ASP.NET 核心 Web 应用程序开发。输入后
npm install -g yo
在终端中,我收到一个错误。
错误描述如下。
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
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/shashankshekhar/.npm/_logs/2020-12-21T11_02_14_859Z-debug.log```
全局模块安装的 EACCES
错误问题非常普遍,以至于 npm
有 an entire web page dedicated to solving just this issue。
因为你正在安装 yeoman,我想这是一台开发机器。在这种情况下,最好的选择可能是使用 nvm
.
node
/npm
你不想做但人们经常建议的一件事是运行将npm
命令与sudo
结合起来.人们推荐它是因为它简单。但是如果你这样做,你正在安装的任何依赖项的所有生命周期脚本(例如 postinstall
)也将是 运行 作为 root
。这可能是 lot 不受信任的代码 运行ning 作为 root
.