workshopper / learnyounode

Learn You The Node.js For Much Win! An intro to Node.js via a set of self-guided workshops.
Other
7.25k stars 1.84k forks source link

-bash: learnyounode: command not found when you try to run "learnyounode" #512

Closed Jabronious closed 7 years ago

Jabronious commented 7 years ago

I have already completed the workshop but none of the others work either so I would like to figure out what is the cause which should allow me to work on the other workshops.

---- Here is my log from attempting to run 'npm install learnyounod -g' --- npm WARN checkPermissions Missing write access to /Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode /Users/jarrodmerryman/.npm-packages/lib └── learnyounode@3.5.10

npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "learnyounode" "-g" npm ERR! node v6.10.0 npm ERR! npm v4.1.2 npm ERR! path /Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, access '/Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode' npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! /Users/jarrodmerryman/npm-debug.log

--- Running it with 'sudo' --- Jarrods-MacBook-Pro:~ jarrodmerryman$ sudo npm install learnyounode -g Password: /Users/jarrodmerryman/.npm-packages/bin/learnyounode -> /Users/jarrodmerryman/.npm-packages/lib/node_modules/learnyounode/bin/learnyounode /Users/jarrodmerryman/.npm-packages/lib └── learnyounode@3.5.10

Jarrods-MacBook-Pro:~ jarrodmerryman$ learnyounode -bash: learnyounode: command not found Jarrods-MacBook-Pro:~ jarrodmerryman$

Jabronious commented 7 years ago

Found out that the modules were being installed in the wrong directory... Ran the first command to figure out what directory it was and set it with the second. Works like a charm now. npm config get prefix npm config set prefix /usr/local