我是meanjs应用程序开发的新手,所以我决定按照http://www.bradoncode.com/tutorials/mean-stack-tutorial-part-1-setup/
我已经安装了开始使用以下命令所需的工具
sudo npm安装-g bower
sudo npm安装-ggrunt cli
sudo npm安装-g yo
sudo npm安装-g生成器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)
请查看此链接:此链接来自npm官方文档。希望能有所帮助。
否则,您可以卸载npm并使用优秀的节点版本管理器(nvm)重新安装。这允许您安装各种版本的节点并一次使用任何一个。它还允许您在没有sudo前缀的情况下运行
npm install
。
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