4

I am trying to run this command npm install -g bower in my python virtual environment that I have my Django project enclosed in, and I end up getting the following error.

-bash: /usr/local/bin/npm: /usr/bin/env: bad interpreter: No such file or directory

My npm file is located at the path above /user/local/bin/npm, what I am confused about is the bad interpreter bit, My os I am using is OSX Yosemite 10.10.5 if that matters. I have been stuck on this issue for hours combing stack overflow and blogs for the answer any suggestion are appreciated.

chicks
  • 2,393
  • 3
  • 24
  • 40
  • 2
    Do you have a `/usr/bin/env` binary? OS X might not allow that idiom for a shebang `#!` line. You can try replacing it with the actual path to whatever it is trying to run instead. – Etan Reisner Sep 02 '15 at 19:58
  • Okay it does have something to do with that, the issue is I'm just not sure what path to change it to exactly, this is what it is currently #!/usr/bin/env node. –  Sep 02 '15 at 20:12
  • 1
    What is the first line in `/usr/local/bin/npm`? It should be something like `/usr/bin/env command` and you just need to replace it with whatever the right path to `command` is. – Etan Reisner Sep 02 '15 at 20:14
  • Yeah, Just not sure what to set command to thats my issue right now. –  Sep 02 '15 at 20:22
  • You have the command *in the script*. To find out what the path is try `type command` in your shell. – Etan Reisner Sep 02 '15 at 20:23
  • type npm install -g bower and got this, npm is hashed (/usr/local/bin/npm) install is /usr/bin/install -bash: type: -g: not found, my command line skills are weak if you could not tell. -bash: type: bower: not found –  Sep 02 '15 at 20:28
  • No... Look at the first line in the `npm` script. Find the argument being passed to `/usr/bin/env`. Run `type `. – Etan Reisner Sep 02 '15 at 20:33
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/88627/discussion-between-appa-lover-and-etan-reisner). –  Sep 02 '15 at 20:33
  • Turns out I was missing /usr/bin/env/ on my computer so I had to factory reset it, even though your solution was a short term solution, for anyone who has this problem in the future this could possibly be the problem. –  Sep 04 '15 at 15:44
  • Interesting. I wonder how that happened. I'm not sure that was the simplest solution to that problem but ok. – Etan Reisner Sep 04 '15 at 16:16
  • Ouch! Factory *reset* to install `/usr/bin/env`? – bishop Sep 11 '15 at 18:51
  • Same issue on Raspberry Pi with Debian Jessie. – igraczech Aug 19 '17 at 16:09

0 Answers0