You can clone with
If you try to run$ nodemon server.js
$ nodemon server.js
You'll get :/usr/bin/env: node: No such file or directory
/usr/bin/env: node: No such file or directory
This is because in Fedora node is called nodejs
This can be fixed by changing: #!/usr/bin/env node on the first line of /usr/lib/node_modules/nodemon/nodemon.js to #!/usr/bin/env nodejs
I agree with you, manually changing that line is not the right way. It was just a proof-of-concept.
A quick $ find /usr/lib/node_modules/ -print0 | xargs -0 grep 'nodejs$' showed that my other packages have #! /usr/bin/env nodejs. So I think you're right, NPMs packaging should handle it.
$ find /usr/lib/node_modules/ -print0 | xargs -0 grep 'nodejs$'
#! /usr/bin/env nodejs
Thanks for looking into it Remy!
Hmm, crap. I've been looking in to this and it doesn't seem there's a clean solution :-\
One suggestion was to use sed to overwrite the hashbag. Optionally you could mod npm to always re-write - but that's fairly extreme.
What scripts did you find that had the nodejs in the hashbag? I've looked around some common ones, but they're all using node in the hashbag (forever, express, ... and something else...I forget - it's late!).
I only have express and nodemon installed right now, and your right they both tried to use #! /usr/bin/env node. The node_modules that I do have that automatically choose #! /usr/bin/env nodejs were:
#! /usr/bin/env node
/usr/lib/node_modules/npm/bin/npm-cli.js:#!/usr/bin/env nodejs/usr/lib/node_modules/npm/cli.js:#!/usr/bin/env nodejs
I had to do one more thing to get Nodemon going on Fedora. I had to search /usr/lib/node_modules/nodemon/nodemon.js for where node is being called in a shell escape and replace it with nodejs. There were three places.
This is also not a "solution" but I don't think I can live without nodemon, so I'll deal with it.
If there's a good way to register nodejs with Fedora instead as node of the HAM radio package that it's currently using I'd be happy.
@dapplebeforedawn - what's the workaround you developed? When I tried editing /usr/lib/node_modules/nodemon/nodemon.js so that so that #!/usr/bin/env node was #!/usr/bin/env nodejs and did a :%s/'node'/'nodejs'/g in vim to catch the three shell execution queries, I still get bash: nodemon: command not found.
bash: nodemon: command not found
For the stray googler that lands on this page: the workaround that worked for me was editing /usr/lib/node_modules/nodemon/nodemon.js so that so that #!/usr/bin/env node was #!/usr/bin/env nodejs and did a :%s/'node'/'nodejs'/g in vim in the same doc to catch the three shell execution queries. After doing that, I still get bash: nodemon: command not found, so after checking ls -la /usr/lib/node_modules/ and noting that the owner and group was wrong on nodemon, I used sudo chown root:root /usr/lib/node_modules/nodemon and sudo chmod 755 /usr/lib/node_modules/nodemon. After that I was able to nodemon app.js on an app just fine.
ls -la /usr/lib/node_modules/
sudo chown root:root /usr/lib/node_modules/nodemon
sudo chmod 755 /usr/lib/node_modules/nodemon
thanks @codekiln for helping out the stray googler :)
For CentOS 6, just add nodemon to your $PATH.
Just commenting on this - but I'm really unsure if there's any way around this problem (other than the change from @codekiln)? i.e. not having to use the hashbang in the nodemon.js script?
The solution/workaround is really simple. This is Linux 101:
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
Fedora and Ubuntu pakage node as nodejs, because node.dpkg is
Description-en: Amateur Packet Radio Node program
The node program accepts TCP/IP and packet radio network connections and
presents users with an interface that allows them to make gateway connections
to remote hosts using a variety of amateur radio protocols.
They make the binary is nodejs, rather than node. So long as you're not using that Packet Radio Node Program mentioned above the workaround will work.
Commenting here because it comes up on google when you search for it, wanted to say that for some people this might happens still even if your path is correct. What happened is my new sublime text install entered in CRLF instead of LF, running "dos2unix" on your files, or using your IDE to save them properly will fix it.