Manually pointing PATH to yeoman after install #430

Closed
chrisdl opened this Issue Sep 14, 2012 · 25 comments

Projects

None yet

7 participants

@chrisdl
chrisdl commented Sep 14, 2012

Got the "There looks to be a problem with the install. :(" message and tried uninstalling, reinstalling cleaning npm cache etc.

Also tried installing with curl -L get.yeoman.io | bash and curl -L get.yeoman.io | sh and doing a manual install.

I think the issue might be that I use ZSH? I solved the issue by manually adding /usr/local/share/npm/lib/node_modules/yeoman/bin/ in my ~/.zshrc file.

Yeoman now seems to be working correctly.

Did I miss something obvious? Was there some other fix? What was causing the issue?

@jackfranklin

Afraid I'm not entirely sure what your issue is but I don't think it's specifically down to ZSH - I use ZSH and it worked fine for me.

@sindresorhus
Member

ZSH working fine for me too. Closing for now, since we can't reproduce.

@chrisdl
chrisdl commented Sep 14, 2012

I should maybe mention that i am not the only user of this computer, but I do have administrator access. So maybe the issue is with multi-user installs?

@jackfranklin

@chrisdl could you post up the results of the following?

echo $PATH
echo $NODE_PATH

Might shed some light.

@chrisdl
chrisdl commented Sep 15, 2012

THIS OUTPUT IS FROM THE WRONG COMPUTER DISREGARD IT.

Sure, check it out.

➜  ~  echo $PATH

/Users/Christopher/.rvm/gems/ruby-1.8.7-head/bin:/Users/Christopher/.rvm/gems/ruby-1.8.7-head@global/bin:/Users/Christopher/.rvm/rubies/ruby-1.8.7-head/bin:/Users/Christopher/.rvm/bin::/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/X11/bin:/usr/local/Cellar/coreutils/8.19/libexec/gnubin:/Users/Christopher/.rvm/bin

➜  ~  echo $NODE_PATH

/usr/local/lib/node_modules

@jackfranklin

@chrisdl Okay, this is me completely guessing...

Maybe $NODE_PATH might be overriding your $PATH, which is why it couldn't find Yeoman. Could you try removing your $NODE_PATH, and adding:

/usr/local/share/npm/bin

To your $PATH, then try? This is on the verge of my shell knowledge so I am mainly guessing but you never know :P This is the set up I have and it works fine.

@chrisdl
chrisdl commented Sep 16, 2012

edit: still wrong computer =( /edit

I don't have npm in /usr/local/share. Which I am guessing is weird.

@jackfranklin

What version of Node are you running? I just upgraded from Node 0.8.1 to 0.8.8 and it comes with npm now (which it didn't used to do, at least not through brew installs), which is why my npm is in that directory. What does

node -v
npm -v

Give?

@chrisdl
chrisdl commented Sep 16, 2012

edit: still wrong comp /edit

~  node -v
v0.8.8

~ npm -v
1.1.13

~ which npm
/usr/local/bin/npm
@jackfranklin

In that case, I'd recommend adding /usr/local/bin/npm to your $PATH, and getting rid of $NODE_PATH.

Then perhaps try installing something else globally and see if it works, eg:

npm install -g coffee-script
coffee -v
@chrisdl
chrisdl commented Sep 16, 2012

I just realized I've had a serious brain fart (in my defence I am running a fairly high fever). I'm not on the computer which has yeoman installed on it right now. I will return to this computer tonight and will test all your awesome suggestions and provide my $PATHand $NODE_PATHon the correct computers.

@jackfranklin

Haha no worries :) I can't say with any confidence anything I've said might help, but might help narrow things down. Would be good to know if this is a Yeoman prob or your system set up. To be honest I suspect the later.

@chrisdl
chrisdl commented Sep 16, 2012

Yeah I feel fairly certain something is simply not pointing to the right place. But I feel like my setup is fairly standard so I thought maybe yeoman install wasn't pointing something correctly, and that it was perhaps not just affecting me.

@chrisdl
chrisdl commented Sep 16, 2012

Alright, back home now. PATH=/usr/local/bin:/usr/local/share/npm/lib/node_modules/yeoman/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin while ``$NODE_PATH` is empty

I have now replaced /usr/local/share/npm/lib/node_modules/yeoman/bin with /usr/local/share/npm/binwhich has had the odd effect of resetting my yeoman version from 0.9.1 to 0.9.0

When searching the computer for yeoman ~find / -name 'yeoman' i was found here:

/usr/local/share/npm/bin/yeoman
/usr/local/share/npm/lib/node_modules/yeoman
/usr/local/share/npm/lib/node_modules/yeoman/bin/yeoman
/usr/local/share/npm/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators/yeoman
/usr/local/share/npm/lib/node_modules/yeoman/tasks/init/yeoman

The ~which npmcommand rendered /usr/local/bin/npm, but pointing my PATH at it did not help (since it wasn't a folder, only the npm executable).

I removed yeoman using ~sudo npm uninstall yeoman -g and reinstalled to see if problem was solved with 0.9.1 release. Installing with yeoman without the /usr/local/share/npm/bin in my PATH caused the yeoman command to not be found. I then tried to install coffee-script as per jackfranklins suggestion and found that downloading it was no issue but running it was an impossibility.

I thus conclude that the root cause of the issue seems to be that nothing in my paths are pointing at my npm modules. I re-added /usr/local/share/npm/bin to my PATH in my .zshrc file and all is now working like clockwork.

@jackfranklin

I re-added /usr/local/share/npm/bin to my PATH in my .zshrc file and all is now working like clockwork.

Awesome, glad you got it sorted.

@sindresorhus is it maybe worth compiling some form of "troubleshooting" document or similar for common issues like this that I imagine might crop up a few times? I'll happily fork & try to put one together if you think it might be beneficial.

@paulirish
Member

Jack, can you add it to https://github.com/yeoman/yeoman/wiki/Additional-FAQ?

Right now that's the easiest place to drop some documentation. Later on
we'll take whats there and turn it into a better resource.

@jackfranklin

@paulirish just saw that you added a bit to the wiki, I'm happy to add a bit more detail to that additional FAQ so I'll do a bit of editing later.

@sindresorhus
Member

@jackfranklin Thanks :)

@felideon

Ran into this issue as well and decided to ask isaacs on #node.js. Seems like there are two similar but separate issues:

  • It seems like Homebrew doesn't create the symlink in /usr/local/bin
  • If an existing Homebrew node installation exists, npm is not placed in /usr/local/bin when installing the node binary from the website.

So the two workarounds are:

  • Add /usr/local/share/npm/bin to $PATH
  • brew uninstall node and install the binary package

hth with the documentation. chat pasted below:

06:41:09 felideon | isaacs: any reason /usr/local/share/npm/bin would not be added to the path (mac 10.6.8) when installing the latest node binary (.pkg) from the website?
07:51:00 @isaacs | felideon: why is it /usr/local/share/npm/bin?
07:51:09 @isaacs | felideon: did you install npm from homebrew or something?
07:51:26 @isaacs | felideon: the node installer puts it right in /usr/local/bin, and assumes that's already in the PATH
08:41:57 felideon | isaacs: it seems like i had installed node (not npm) from homebrew at some point. not sure if that's how it made it there. but when I installed the node binary from the nodejs website, it didn't put it in /usr/local/bin
08:44:29 felideon | isaacs: ok so i did a 'brew uninstall node' and then re-installed the node binary, and npm is now at the right spot.

@okonet
okonet commented Feb 1, 2013

Had the same problem installing node & npm using Homebrew. Solved by adding /usr/local/share/npm/bin to $PATH

@bnvk
bnvk commented May 13, 2013

Ok. I've added the following two lines to my .bash_profile on Mac OS and that eliminated the path not found issue

export PATH=/usr/local/share/npm/bin:$PATH

But I'm getting a strange error when I actually try to create an app with Yeoman. Any help would be greatly appreciated!

$ yo webapp
Error: EACCES, permission denied '/Users/brennannovak/.config/configstore'
    at Object.fs.mkdirSync (fs.js:483:18)
    at Function.sync (/usr/local/share/npm/lib/node_modules/yo/node_modules/insight/node_modules/configstore/node_modules/mkdirp/index.js:55:12)
    at readFile (/usr/local/share/npm/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:19:11)
    at Object.create.all.get (/usr/local/share/npm/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:36:22)
    at Object.Configstore (/usr/local/share/npm/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:30:40)
    at new Insight (/usr/local/share/npm/lib/node_modules/yo/node_modules/insight/lib/insight.js:20:16)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/yo/bin/yo:22:15)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)

UPDATE: As suggested I ran $ brew uninstall node and then reinstalled via the installer on nodejs.org and then upon installing Yeomin I ran into a permission error with simple

$ npm install yo

So trying with

$ sudo npm install yo

It seemed to work, but now to run $ yo webapp runs into the same permissione error as above, but upon running $ sudo yo webapp it created the project, but it installed EVERYTHING into the local /node_modules folder and everything is owned by root... #argh #wish-I-was-better-at-CL-things

@sindresorhus
Member

@brennannovak Yeoman don't have permission to that folder and throws. sudo chown -R $USER /Users/brennannovak/.config might do the trick.

@bnvk
bnvk commented May 13, 2013

Ah yes, that did the trick, thanks @sindresorhus :) However running

$ yo webapp 

Seems to install bower and about 20+ grunt modules into the local /node_modules folder instead of finding them in the gobal. Is this correct behavior?

@sindresorhus
Member
@ghost
ghost commented May 29, 2015

Hey ! I had the same trouble !
I used :
$HOME/npm/bin
And it pretty worked for me !! 👯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment