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
  • 51,761
  • 10
  • 113
  • 139
plsnoban
  • 351
  • 5
  • 17

3 Answers3

0

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

sjfkai
  • 98
  • 1
  • 10
  • 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
  • 488
  • 3
  • 11
  • `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,370
  • 7
  • 50
  • 81