0

I am using Vagrant to run the default linux VM (with admin privilleges so that symlink works)

After installing a package with npm install -g <package>, I am unable to run the symlink created (as a shortcut to run from path).

The file contents as follows:

#!/usr/bin/env node
var arguments = process.argv.slice(2);
var fs = require('fs');
var usage = fs.readFileSync(__dirname + '/usage.txt').toString();

if (arguments.length < 3) {
    console.error(usage);
    return;
}

var summon = require('./Summoner');

summon(arguments[0], arguments[1], arguments[2]);

Running the file with <filename> directly doesn't work, throwing : No such file or directory, whereas running it with node <filename> will work.

I have tried npm install -g gulp and running gulp works perfectly. Checking the contents of gulp, I see that the #!/usr/bin/env node line is exactly the same as this file, so what am I missing here?

Frederic Henri
  • 48,743
  • 7
  • 106
  • 131
plsnoban
  • 321
  • 5
  • 15

3 Answers3

0

check if the node executable is in /usr/bin/env

sjfkai
  • 88
  • 1
  • 9
  • maybe you can look at [this](http://stackoverflow.com/questions/20886217/browserify-error-usr-bin-env-node-no-such-file-or-directory) – sjfkai Nov 18 '15 at 09:50
  • the link you posted has the problem of `node` not being linked to `nodejs`, but my `node` seems to be linked properly – plsnoban Nov 23 '15 at 07:26
0

Check the symlink that has been created for the module that you installed and whether it is executable by your user.

ls -l $(which summon)

Shamps
  • 468
  • 3
  • 10
  • `lrwxrwxrwx 1 root root 34 Nov 17 18:20 /usr/bin/eportal -> ../lib/node_modules/eportal/cli.js` is what I got back – plsnoban Nov 18 '15 at 08:50
0

I just had this problem due to the fact that my Node project's bin/script had CR+LF line endings instead of Linux LF-only line endings.

Wayne Bloss
  • 5,118
  • 6
  • 46
  • 75