sh: 1: node_modules/.bin/bower: Permission denied
npm ERR! weird error 126
npm WARN This failure might be due to the use of legacy binary “node”
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
I want to persevere because I love using roots but every new version introduces so many teething issues for me . Anyone encountered this or able to suggest a solution?
I already tried doing sudo npm install -g bower, which executes without errors as far as I can tell, still doesn’t let me run npm install.
npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
npm ERR! error rolling back Error: EACCES, unlink ‘/usr/local/bin/bower’
npm ERR! error rolling back bower@1.3.7 { [Error: EACCES, unlink ‘/usr/local/bin/bower’] errno: 3, code: ‘EACCES’, path: ‘/usr/local/bin/bower’ }
npm ERR! Error: EACCES, unlink ‘/usr/local/bin/bower’
npm ERR! { [Error: EACCES, unlink ‘/usr/local/bin/bower’] errno: 3, code: ‘EACCES’, path: ‘/usr/local/bin/bower’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-24-generic
npm ERR! command “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” “bower”
npm ERR! cwd /var/www/example.dev/web/app/themes/roots
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/bin/bower
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink ‘/usr/local/bin/bower’
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/example.dev/web/app/themes/roots/npm-debug.log
npm ERR! not ok code 0
Tried it and it gave the above response, I’m out of my depth here! Should probably mention I’m on a Ubuntu 14/Nginx Vagrant VM ceated using the puphpet website.
As I mentioned above in the first post I already tried sudo npm install -g bower which executed with no errors, however npm install gives the error pasted in my first post.
trying sudo npm install gives this:
$ sudo npm install
npm WARN cannot run in wd roots@7.0.0 node_modules/.bin/bower install (wd=/var/www/example.dev/web/app/themes/roots)
Which seemed like it had completed just with a warning, but then trying grunt watch or sudo grunt watch both give:
I suggest deleting the entire node_modules dir and starting over. Should probably make sure you have a relatively recent version of Node as well in case there’s been npm bugs fixed.
Make sure Node is installed (which is done)
sudo npm install -g grunt-cli
sudo npm install -g bower
In roots dir: npm install --ignore-scripts
In roots dir: bower install
There may be some issue with the postinstall script in your first post, so using --ignore-scripts will skip it then you run bower install manually.
sh: 1: node_modules/.bin/bower: Permission denied
npm ERR! weird error 126
npm WARN This failure might be due to the use of legacy binary “node”
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
So seems as if --ignore-scripts didn’t work and there appears to be an unexplained problem with ‘legacy binary’ version of node?
The ‘weird error 126’ doesn’t help much!
Really need to try it on the original VM in question and let you know if it sorted anything, but I’m beginning to doubt it will.
Both are Ubuntu 14 Vagrant VMs generated with puphpet (if you’re familiar I could even attach a config.yaml for puphpet if it helps) and node was installed by running sudo apt-get install npm and letting apt figure out the dependencies… so I assume it’s just the latest one from the Ubuntu repos.
But exactly the same fail/error happens when I try npm install.
I think “weird error 126” must be the problem! If you google “weird error 126” this thread is on the top page of results which makes me think it can’t be very common…?
There are errors at step 4, but I just ignored them. Ran bower install, which complained but still completed. Then rant grunt and got “/usr/bin/env: node: No such file or directory”.
After some more headaches, I ran which nodejs (“/usr/bin/nodejs” for me). Then put a simlink to that in the place where grunt was looking.
sudo ln -s /usr/bin/nodejs /usr/bin/node
Now grunt works as it should I think! Not really sure if what I’m doing is ideal.
@mikesource Hi. Did you get to the bottom of this? I think I’m hitting the same issue. If I try ‘grunt watch’ or ‘grunt dev’, I get:
grunt watch
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started