Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sudo Errors When re-Installing #327

Closed
skippednote opened this issue Sep 10, 2012 · 27 comments
Closed

Sudo Errors When re-Installing #327

skippednote opened this issue Sep 10, 2012 · 27 comments

Comments

@skippednote
Copy link

edit by admin:
This ticket now tracks a yeoman reinstall issue where a sudo password is required but fails. see below comment for summary.





➜  ~ git:(master) ✗ curl -L get.yeoman.io | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 10835  100 10835    0     0   2705      0  0:00:04  0:00:04 --:--:--  7441
Looks like you have the XCode CLI tools. Passed!

Installing on OS X.
You've got brew, nice work chap!
bash: line 112: [-z: command not found

             .-:/+ossyhhhddddddddhhhysso+/:-.               
       ./oymNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmho/.         
     .yNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNh'       
     -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN-       
      dNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNd        
      +NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN+        
      .NNNNNNNNNNNNNNNNNNNdhyyyhmNNNNNNNNNNNNNNNNNN.        
       hNNNNNNNNNNNNNNNmssyhshshyoyNNNNNNNNNNNNNNNh         
       /NNNNNNNNNNNNNNd+ds++yhoooyy+NNNNNNNNNNNNNN/         
       'NNNNNNNNNNNNNN/do+hsosoys/hssNNNNNNNNNNNNm'         
        hNNNNNNNNNNNNN:N//d:hmooh+sh+NNNNNNNNNNNNy          
        /No---------+Nosh+oyyssyo/d+hm:--------yN:          
        'Ny          omssyy/ys/ssyohm:         dm           
    -----dN-----------+mmyssyyssshmd/---------:Nh-----      
   'dmmmmNNNNNNNNNNNNNNNNNNNmmmNNNNNNNNNNNNNNNNNNmmmmh      
    /NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN:      
    'yhhhhdNNdddddddddmNNNdhhhhhhhhhhhhhhhhhhhhhhhhhs       
          :Nm'''.:oso+:/smd:      '-/oso:.'                 
          'NN' /dNNNNNmo':Nm'    'smNNNNNd:                 
           hN/ .+hdmmho-  hN:     -sdmmdy/'                 
           /Nh    '.'     hN/        '.'                    
            mN-           hN/.'                             
            :Nd'          ymdddy'                           
             sNy'        '-:::::.'                          
              sNs'   ':ohdmNNyNNmdyo:'                      
               oNh--smNNNNNNd'dNNNNNNms-                    
                :mNNNNNNNNNh. .dNNNNNNNNy.                  
                :mNNNNNNNd/'   '+dNNNNNNNm-                 
               'ydmmmdmNms+:-..'  -+ydmmmds'                
                       ./oyhmmms                            



                   Welcome to Yeoman! 


We're going to check some dependencies and install them if they're not present

Stand by...

tar=/usr/bin/tar
Good gracious! You've got this version of 'tar' installed:
bsdtar 2.8.3 - libarchive 2.8.3

Ruby is installed.

Node.js is installed.

Installing dependencies for OS X.
git is installed.
optipng is installed.
Installing jpeg-turbo...
Error: jpeg-turbo-1.2.1 already installed
phantomjs is installed.
Linking /usr/local/Cellar/jpeg-turbo/1.2.1... 
Error: Could not symlink file: /usr/local/Cellar/jpeg-turbo/1.2.1/include/turbojpeg.h
/usr/local/include is not writable. You should change its permissions.

Compass is already installed, you may want to 'gem install compass -pre' for the latest goodness.

Now the dependencies are sorted let's grab the latest yeoman goodness

Alright buckaroo, hold on to your hats..
We're about to install the yeoman CLI, which will in turn install quite a few node modules
We're going to move fast, but once we're done, 
you'll have the power of a thousand developers at your blinking cursor.
Okay here we go...
npm http GET https://registry.npmjs.org/yeoman
npm http 304 https://registry.npmjs.org/yeoman
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/yeoman'
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/yeoman']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/yeoman',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/yeoman',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ 'DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR!      'Object.oncomplete (fs.js:297:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "yeoman" "-g"
npm ERR! cwd /private/var/folders/kc/xcrrtk6x0wb8v4c537m4jhk00000gn/T/yeoman.24370
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.59
npm ERR! path /usr/local/lib/node_modules/yeoman
npm ERR! fstream_path /usr/local/lib/node_modules/yeoman
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/yeoman'
npm ERR! fstream_stack DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/kc/xcrrtk6x0wb8v4c537m4jhk00000gn/T/yeoman.24370/npm-debug.log
npm ERR! not ok code 0

Yah Hoo! Yeoman global is in place.


My my, I hope you enjoyed that as much as I did.
Yeoman and all its dependencies are now installed!

Now that we've got our ducks in a row...
You should try starting a new project with yeoman.
... might I suggest: 
       mkdir myYeomanApp
       cd myYeomanApp   
       yeoman init      

See you on the other side!
@paulirish
Copy link
Member

Looks like the script couldnt detect it needed sudo for the npm install...

sudo npm install -g yeoman should sort you out

@addyosmani
Copy link
Member

If you have any further issues once using @paulirish's suggestion above, please feel free to share your output again and we'll be happy to assist further.

@sindresorhus
Copy link
Member

@tomlane This also stood out to me:

bash: line 112: [-z: command not found

@ggamel
Copy link
Contributor

ggamel commented Sep 10, 2012

Even after using @paulirish's suggestion, here's what I am presented with:

~  ⚡ sudo npm install -g yeoman
npm http GET https://registry.npmjs.org/yeoman
npm http 304 https://registry.npmjs.org/yeoman

> yeoman@0.9.0 uninstall /usr/local/share/npm/lib/node_modules/yeoman
> sudo rm -r ~/.yeoman


WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Sorry, try again.
Password:

Here's the catch: I'm actually entering my password correctly every single time. I even locked my computer, logged out, restarted, closed and reopened iTerm multiple times. Not really sure what the heck I've done incorrectly.

I tried doing the one-line installer, if that matters.

@paulirish
Copy link
Member

@sindresorhus the lack of a -f flag breaks this rm when the folder doesnt exist.

@paulirish
Copy link
Member

ideally the rm checks if ~/.yeoman exists before nuking it.

@skippednote
Copy link
Author

Same thing happens as @ggamel pointed out with sudo npm install -g yeoman

@awbraunstein
Copy link

I am also getting the same error as @ggamel.

@Gnex77
Copy link

Gnex77 commented Sep 10, 2012

I got a similar error when I tried to install the new version. I had the pre-beta installed. I had to do a global uninstall and update Homebrew before everything worked for me.

@paulirish
Copy link
Member

quick fix:

mkdir -p ~/.yeoman
sudo npm install -g yeoman

We're working on something better. Thanks

@ggamel
Copy link
Contributor

ggamel commented Sep 10, 2012

Still no luck. I'm still being asked (twice) to enter my password; first time, password accepted; second time, password rejected. Again, I'm using the correct password.

Here's the output: https://gist.github.com/3693073

@skippednote
Copy link
Author

mkdir -p ~/.yeoman sudo npm install -g yeoman

Worked fine for me. Thanks Paul

@ggamel
Copy link
Contributor

ggamel commented Sep 10, 2012

Have tried a few different things, uninstalling yeoman, etc, etc. Cannot seem to pinpoint what is causing the 2nd password request failure. Never accepts my password the 2nd time around. Hmm. Thoughts on where I can/should look, @paulirish? 😎

@paulirish
Copy link
Member

okay ggamel.. first, can you confirm the "quick fix" doesn't work? it should.

this is a bit of a hack but should get you out of this.

$ which yeoman
/usr/local/bin/yeoman

$ readlink `which yeoman`
../lib/node_modules/yeoman/bin/yeoman

You probably get the same path for those two commands.. assuming you do..

vim /usr/local/lib/node_modules/yeoman/package.json 

go to line 30 where it has the uninstall script. delete the contents so its just an empty string for uninstall.

@ggamel
Copy link
Contributor

ggamel commented Sep 10, 2012

None of that worked. The yeoman package.json file didn't even exist.

So strange. Still having issues. I have node install via brew and it installed npm. Could that be the issue?

After trying the "quick fix" again, I've no idea why, when prompted a 2nd time for my password, it never accepts it and the install fails.

@trev
Copy link

trev commented Sep 11, 2012

I can confirm that removing the uninstall line worked for me but not the previous solution.

@paulirish
Copy link
Member

Okay, here we go:

Our uninstall script in package.json read sudo rm -r ~/.yeoman when we shipped 0.9. (It now reads rm -rf ~/.yeoman)

But turns out npm will, in some cases run this script as the nobody user. And what is the sudo password for nobody? Good question.

Our auto-update procedure will trigger this behavior on a few folks so we should figure out the best path upwards. @sindresorhus @addyosmani

@ghchinoy reported rm -rf ~/.yeoman && rm -rf ~/.npm/yeoman worked for him to allow a clean re-install. Pretty sure that's going to be the safest best here; I don't like the mkdir -p quickfix nor fux0ring with chown.

@ggamel can you confirm?

If it's good we'll have to have this documented for when we pull the 0.9.1 trigger and potentially trigger this for some others.

@sindresorhus
Copy link
Member

@paulirish It's not the uninstall command which breaks the install process:

> rm -r ~/.yeoman
rm: /Users/sindresorhus/.yeoman: No such file or directory
npm WARN continuing anyway yeoman@0.0.1 uninstall: `rm -r ~/.yeoman`
npm WARN continuing anyway `sh "-c" "rm -r ~/.yeoman"` failed with 1

NPM will just continue even though the uninstall failed.

I think rm -rf ~/.yeoman && rm -rf ~/.npm/yeoman should do it. Might even do rm -rf ~/.yeoman && rm -rf ~/.npm/yeoman && npm cache clean to be sure.

@josemotanet
Copy link

Removed ~/.yeoman and ~/.npm/yeoman. Also cleaned npm's cache. Problem still remains here.

@ggamel
Copy link
Contributor

ggamel commented Sep 11, 2012

@paulirish Here's what I managed: I ran the sudo npm install -g yeoman command, then opened another tab in iTerm, edited and removed the uninstall line, then managed to get yeoman installed. However, that was such a dirty-feeling method. I played around with it a bit until I saw your update.

SO! - I tried the removal method you mentioned (cheers @ghchinoy). Then I tried running the yeoman command to see if anything lingered. It did, except I was just reprompted like so:

~  ⚡ rm -rf ~/.yeoman && rm -rf ~/.npm/yeoman
~  ⚡ yeoman
==========================================================================
We're constantly looking for ways to make yeoman better! 
May we anonymously report usage statistics to improve the tool over time? 
More info: yeoman.io/docs/insight/ & http://yeoman.io
==========================================================================
[?] [Y/n]:  (Y) 

This catches you up-to-date. I even tried re-running the one-liner install and was still double-prompted for my password (once for my user acct, once for nobody).

Something is still amiss. I'll note I have yet to try removing the dirs mentioned by @sindresorhus or @josemota.

@ghchinoy
Copy link

It's not just rm -rf ~/.yeoman && sudo rm -rf ~/.npm/yeoman* but also sudo rm -rf /usr/local/lib/node_modules/yeoman (or, sudo npm -g uninstall yeoman to be less harsh, re: @ggamel)

That did it for me (just reconfirmed).

@josemotanet
Copy link

Updated git repo just about now. Successfully installed after following @ghchinoy 's instructions. Thanks man.

@ggamel
Copy link
Contributor

ggamel commented Sep 11, 2012

Working for me now. Re-ran the install with the one-liner and I'm sitting pretty.

@josemotanet
Copy link

Just a heads up: sadly I've been facing errors again regarding sudoing twice, one for my user, another one for what it appears to be nobody. All the folders suggested by @ghchinoy were removed. The double sudo appears upon installing yeoman's module dependencies:

~/code/yeoman/cli $ sudo npm install -g

> yeoman@0.9.0 uninstall /usr/local/share/npm/lib/node_modules/yeoman
> sudo rm -r ~/.yeoman


WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Sorry, try again.
Password:

@paulirish
Copy link
Member

The error is prompted by the npm uninstall script in yeoman 0.9.0's package.json. You could manually remove it from line 29 of /usr/local/lib/node_modules/yeoman/package.json to avoid the problem.

I've documented the uninstall procedure here: https://github.com/yeoman/yeoman/wiki/Additional-FAQ

I'm going to close this issue now, thanks everyone for helping out so much with this doozy!

@josemotanet
Copy link

I apologize for bringing this up again but I'm still not able to install yeoman correctly from npm. Since I haven't been able to try yeoman lately, I decided to update the git clone I have in my machine.

So I pulled the latest changes along with the excellent audit script and the only thing left was to install yeoman itself. Typing sudo npm install -g will still ask for a password, twice. I've done everything that's in the FAQs and yet the problem's there.

I'm using Mac OS X 10.7.4, with Homebrew. npm version is 1.1.59.

@onpulse
Copy link

onpulse commented Oct 26, 2012

@josemota Not sure if you've figured your issue out. This might be helpful for others.
I'm using Ubuntu 12.10 and I am using nvm to maintain my installation of node so that I have the latest available. My mistake was installing it as the root user (Got lazy and did sudo su) and because some things try to use the nobody user there was a problem with a post install command issued during the lodash npm module install.

Once I moved nvm to /opt/nvm and redid my npm and node links everything worked perfect!

Hope this helps someone.
Deane

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

No branches or pull requests