質問

I have been trying to install Yeoman and get it configured on Ubuntu 12.04. (running in Vmware)

Had it working at one stage then I come back from lunch and try it and its not reading where my generators are.

What I have done:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

npm config set prefix ~/npm        
#added to ~/.bashrc
export PATH=$HOME/npm/bin:$PATH

yo wasnt being read at one stage so I did this 
$ sudo npm rm -g yo  
npm cache clean  
$ sudo npm install -g yo

I was also getting access errors so I did this

chmod 775 .npm   
chmod 775 .npm/touch

Everything is there in ~/npm/lib/node_modules but it just doesnt seem to be finding them.

Wrecking my head at this stage.

役に立ちましたか?

解決

When trying to download a new generator I ran into an issue regarding my NODE_PATH:
- NODE_PATH =/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
- NPM root = /home/carlos/npm/lib/node_modules/lib/node_modules
- [Fix] Append the NPM root value to your NODE_PATH variable
- Add this line to your .bashrc

export NODE_PATH=$NODE_PATH:/home/carlos/npm/lib/node_modules/lib/node_modules 

Or run this command

echo "export NODE_PATH=$NODE_PATH:/home/carlos/npm/lib/node_modules/lib/node_modules" >> ~/.bashrc && source ~/.bashr

I added the line to my ~/.bashrc and it seems to have sorted the issue. My generators are now showing up.

I ended up writing a post about my issues with yemoan and nodejs
The problems I was having were permission problems which were in relation to nodejs, npm, and where things were being installed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top