问题描述
几天前尝试了一下,在一个项目中使用了 yeoman.经过一番摆弄后,我让它在我的电脑上工作,但后来出现问题,现在该项目不再运行.我认为这个问题与 yeoman 安装在一个地方有关,但系统在另一个地方寻找它.我想,但很明显,我不知道哪里出了问题.
Took the plunge a couple of days ago, using yeoman for a project. After some fiddling I got it to work on my computer, but then something got messed up and now the project is not running anymore. I think the issue has to do with yeoman installing in one place, but the system looking for it in another. I think, but obviously, I don't exactly know where things are going wrong.
我认为这两个位置是:
Users/brian/
usr/local/lib
usr/local/bin
我不确定应该在哪里为 Yeoman 安装东西.我意识到最初,我使用 sudo 来安装东西,这可能会搞砸一些事情,或者我正在使用自制软件.我已经卸载了自制软件,不再需要使用 sudo 来安装东西.
I am not sure where things should be installing for Yeoman. I realize that initially, I was using sudo to install things and that might have messed some thing up, or that I was using homebrew. I have since uninstalled homebrew and no longer need to use sudo for nom to install stuff.
$ node -v
v0.10.22
$ npm -v
1.3.14
$ echo $NODE_PATH
什么都不返回.
$ echo $PATH
/Users/brian/.rvm/gems/ruby-2.0.0-p0/bin:/Users/brian/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/brian/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/brian/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
$ which npm
返回/usr/local/bin/npm
returns /usr/local/bin/npm
$ npm install -g yo
似乎安装得很好,最后它说:
Seems to install fine, at the end it says:
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/bin/yo
yo@1.0.5 /usr/local/lib/node_modules/yo
但是如果你在它说之后运行 yo -v:env: node\r: 没有那个文件或目录
but if you run yo -v after it says:env: node\r: No such file or directory
如果我跑:
sudo nano /etc/paths
它显示了以下路径,其中我添加了最后一个路径:
it shows the following paths, of which I added the last path:
/usr/bin
/bin
/usr/sbins
/usr/local/bin
/usr/local/bin/npm
我在很多地方都有 node_modules 文件夹.
I have node_modules folders in a number of places.
Users/brian/node_modules
usr/local/lib/node_modules
以及其他一些地方.
哪里出了问题?npm 应该在哪里安装 yeoman 的东西以及系统如何引用它,所以当我写类似 $ yo -v 之类的东西时它知道它在哪里
Where are things going wrong? Where should npm install yeoman stuff and how does the system refer to it, so it know where it is when I write stuff like $ yo -v
非常感谢您对此的任何帮助.
Thanks a lot for any help with this.
谢谢!
推荐答案
yo
的 1.0.5
发布存在问题.尝试其他用户的一些解决方案.基本上:
There was an issue with the 1.0.5
launch of yo
. Try some solutions from other users. Basically:
$ npm uninstall -g yo
$ npm cache clean
$ npm install -g yo
这篇关于Yeoman 安装/节点路径问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!