ember.js – 无法在没有sudo的情况下安装Ember-CLI

前端之家收集整理的这篇文章主要介绍了ember.js – 无法在没有sudo的情况下安装Ember-CLI前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
npm install -g ember-cli


npm ERR! Error: Attempt to unlock ember-cli,which hasn't been locked
npm ERR!     at unlock (/usr/local/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/lib/cache/add-local.js:30:5)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/cache/add-local.js:47:20
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/locker.js:30:7
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help,you may report this *entire* log,npm ERR! including the npm and node versions,at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.2.0-61-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/ahmed
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ahmed/npm-debug.log
npm ERR! not ok code 0

使用sudo进行安装时,在创建新应用时遇到问题.

sudo npm install -g ember-cli
/usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/couch-login requires request@'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,npm WARN unmet dependency which is version 2.30.0
ember-cli@0.0.44 /usr/local/lib/node_modules/ember-cli
├── abbrev@1.0.5
├── js-string-escape@1.0.0
├── broccoli-writer@0.1.1 (rsvp@3.0.13,quick-temp@0.1.2)
└── yam@0.0.14 (lodash@2.4.1,findup@0.1.5,fs-extra@0.8.1)
ahmed@shivank-Vostro-2420:~$ember -v
version: 0.0.44
node: 0.10.31
npm: 1.4.26

解决方法

首先完全删除节点
$rm -rf ~/.npm ~/.nvm

使用NVM管理节点版本……

$curl https://raw.githubusercontent.com/creationix/nvm/v0.17.1/install.sh | bash
$source ~/.nvm/nvm.sh
//add this line to my ~/.bashrc,~/.profile,or ~/.zshrc

使用nano在配置文件添加源:

$nano~ / .profile

转到文件底部添加以下行:

source~ / .nvm / nvm.sh

然后按CTR X并按Y保存

其他人一样……

使用稳定版本的节点

$nvm install 0.10.32
$nvm use 0.10.32
$nvm alias default 0.10.32

安装Node后,您需要全局安装Ember CLI:

$npm install -g ember-cli

这将使您可以访问ember命令行运行程序.

您需要安装Bower,这是一个包管理器,可以使您的前端依赖(包括JQuery,Ember和QUnit)保持最新.这和运行一样简单:

$npm install -g bower

这将使您可以访问bower命令行运行程序.

现在您可以运行enberCLI命令.

干杯.

猜你在找的JavaScript相关文章