安装yeoman时出现问题

Problems installing yeoman

本文关键字:问题 yeoman 安装      更新时间:2023-09-26

我正在尝试安装yeoman,但收到以下错误消息:

我确实安装了node.js和npm(最新版本),现在我正在做这个

npm install -g yo grunt-cli bower
and 
npm install -g yo 

但是我收到以下错误信息

npm http GET https://registry.npmjs.org/yo
npm http 200 https://registry.npmjs.org/yo
npm ERR! Error: No compatible version found: yo
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/siddhartha/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-19-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /home/siddhartha
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: yo
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/siddhartha/npm-debug.log
npm not ok

怎么了?这是我的linux系统、npm还是node.js的问题?我需要yeoman尽快起床跑步,但我被卡住了。

您可以尝试读取错误消息:

npm ERR!可能与您的node版本不兼容?

Yeoman需要节点>=0.8,但您有节点0.6:

npm ERR!节点-v v0.6.19

升级到最新的稳定节点就可以了。

sudo apt-get install node -y

我使用的是Ubuntu 12.10。

我也有同样的问题。

我将描述我对的确切修复

npm install -g yo
  1. Yeoman要求节点版本>=0.8
  2. 由于权限的原因,我需要使用sudo npm install -g yo

步骤是:

sudo apt-get install python-software-properties -y
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update -y
sudo apt-get install nodejs -y
sudo npm install -g yo

install nodejs将节点更新为最新版本

add-apt-repository需要一个更好的存储库来更新nodejs

python-software-propertiessoftware-properties-common用于add-apt-repository

供参考:

请参阅https://stackoverflow.com/a/16032073/80353这解释了为什么您需要安装python或软件来运行add-apt-repository

请参阅https://stackoverflow.com/a/16303380/80353这启发了

的一般步骤