ubuntu - 哟meanjs应用模板安装错误

标签 ubuntu npm meanjs yo

我是 meanjs 应用程序开发的新手,所以我决定按照 http://www.bradoncode.com/tutorials/mean-stack-tutorial-part-1-setup/ 上的教程进行操作

我已经安装了开始使用以下命令所需的工具
sudo npm install -g bower
sudo npm install -g grunt-cli
sudo npm install -g 哟
sudo npm install -g generator-meanjs

我已经创建了一个项目目录,但是meanjs应用程序安装总是在某个点失败并出现以下错误
同时使用 yo meanjs 和 sudo yo meanjs 命令
.我知道这与root权限有关,请帮助我!

Error: Command failed: /bin/sh -c cd mean && npm install.
npm ERR! Linux 3.19.0-30-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.12
npm ERR! path /home/omoniyi289/.npm/mongoose/4.2.5
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/home/omoniyi289/.npm/mongoose/4.2.5'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/home/omoniyi289/.npm/mongoose/4.2.5']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/omoniyi289/.npm/mongoose/4.2.5',<br>
npm ERR!   parent: 'mean' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/omoniyi289/NorthwindNode/mean/npm-debug.log

at ChildProcess.exithandler (child_process.js:203:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

最佳答案

请查看此链接:
this link
来自官方 npm 文档。希望能帮助到你。

Otherwise you could uninstall npm and reinstall with the excellent node version manager(nvm). This alows you to install various versions of node and use whichever at a time. It also allows you to run npm install without the sudo prefix.


npm install -g nvm

更新您的路径以包含 ./node_modules/.bin
 export PATH=./node_modules/.bin:$PATH

然后安装节点版本(例如 5.0)
nvm install 5.0

然后使用 5.0 版
nvm use 5.0

关于ubuntu - 哟meanjs应用模板安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33676564/

相关文章:

javascript - Node Webpack 无法识别 "Import"

node.js - 如何使用 mongoose-seeder,无法插入数据

node.js - 从 cli 过滤 grunt 任务 src

ubuntu - 如何在Ubuntu中设置Java环境路径

python - ubuntu 12.04 上的 CUDA 安装

java - Linux,top 命令,为什么 "data"值和 jvm -xmx 参数不相等?

angular - "You seem to not be depending on "@ Angular/核心 "."

angularjs - NgDocs Provider 怎么用呢?

angularjs - Node.js $http PUT 请求不会向服务器返回任何内容

android - 访问 android 手机 Ubuntu 19.10 时出现未处理的错误消息