1

I'm using Vagrant on Windows 10. After installing all the dependecies with npm install (or npm install --no-bin-links, since I'm in Vagrant on Windows), ./node_modules/.bin is empty. I expect to find there some command line tools.

In my case, it is svg2png-many that is missing.

I also tried to rebuild with npm rebuild svg2png-many, but this didn't create the missing file.

Note: I didn't get any error running npm install, simply the file is not there:

./svg2png.sh: line 8: ./node_modules/.bin/svg2png-many: No such file or directory

and this is in that file

for t in "${themes[@]}"
do
  echo "dist/img/${t}/"
  ./node_modules/.bin/svg2png-many -i "dist/img/${t}/" "dist/img/${t}/"
done

What should I try next ?

Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121
  • But you run the command with `--no-bin-links`, so the link are not created – greuze May 29 '17 at 15:27
  • @greuze If a run `npm install`, the cli files are not created either. Do you mean that the files in `./node_modules/.bin` are just symlinks ? – Lorenz Meyer May 29 '17 at 15:29
  • Yes, exactly, inside `./node_modules/.bin` there are symbolic links to the modules binaries. But `npm install` should download the modules in `./node_modules/` – greuze May 29 '17 at 15:34
  • @greuze are you using virtualbox shared folder ? If so, then update the virtualbox guest additions in the guest. – tux May 29 '17 at 15:40

1 Answers1

2

If you are specifying --no-bin-links, the binaries are not going to be available in ./node_modules/.bin, as they are symbolic links to modules binaries. You can see in npm documentation:

The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.

If you run npm install you should get all the modules in package.json file downloaded in node_modules folder. Here is an example of output (after installing without --no-bin-links flag):

$ ls -l node_modules/.bin
total 0
lrwxrwxrwx 1 ils ils 36 may 17 17:01 conventional-changelog -> ../conventional-changelog-cli/cli.js
lrwxrwxrwx 1 ils ils 39 may 17 17:01 conventional-changelog-writer -> ../conventional-changelog-writer/cli.js
lrwxrwxrwx 1 ils ils 37 may 17 17:01 conventional-commits-parser -> ../conventional-commits-parser/cli.js
lrwxrwxrwx 1 ils ils 39 may 17 17:01 conventional-recommended-bump -> ../conventional-recommended-bump/cli.js
lrwxrwxrwx 1 ils ils 34 may 17 17:01 cross-env -> ../cross-env/dist/bin/cross-env.js
lrwxrwxrwx 1 ils ils 24 may 17 17:01 dateformat -> ../dateformat/bin/cli.js
lrwxrwxrwx 1 ils ils 22 may 17 17:01 get-pkg-repo -> ../get-pkg-repo/cli.js
lrwxrwxrwx 1 ils ils 25 may 17 17:01 git-raw-commits -> ../git-raw-commits/cli.js
lrwxrwxrwx 1 ils ils 25 may 17 17:01 git-semver-tags -> ../git-semver-tags/cli.js
lrwxrwxrwx 1 ils ils 28 may 17 17:01 handlebars -> ../handlebars/bin/handlebars
lrwxrwxrwx 1 ils ils 22 may 17 17:01 JSONStream -> ../JSONStream/index.js
lrwxrwxrwx 1 ils ils 21 may 17 17:01 lerna -> ../lerna/bin/lerna.js
lrwxrwxrwx 1 ils ils 20 may 17 17:00 mkdirp -> ../mkdirp/bin/cmd.js
lrwxrwxrwx 1 ils ils 39 may 17 17:01 npm-run-all -> ../npm-run-all/bin/npm-run-all/index.js
lrwxrwxrwx 1 ils ils 16 may 17 17:01 rimraf -> ../rimraf/bin.js
lrwxrwxrwx 1 ils ils 33 may 17 17:01 run-p -> ../npm-run-all/bin/run-p/index.js
lrwxrwxrwx 1 ils ils 33 may 17 17:01 run-s -> ../npm-run-all/bin/run-s/index.js
lrwxrwxrwx 1 ils ils 20 may 17 17:00 semver -> ../semver/bin/semver
lrwxrwxrwx 1 ils ils 51 may 17 17:01 sl-log-transformer -> ../strong-log-transformer/bin/sl-log-transformer.js
lrwxrwxrwx 1 ils ils 22 may 17 17:00 strip-indent -> ../strip-indent/cli.js
lrwxrwxrwx 1 ils ils 25 may 17 17:01 uglifyjs -> ../uglify-js/bin/uglifyjs
lrwxrwxrwx 1 ils ils 18 may 17 17:01 which -> ../which/bin/which

If you need to install a missing module, you can delete all downloaded dependencies before running npm install, or just install the dependency by running npm install svg2png-many.

I run the command and get the svg2png-many downloaded in ./node_modules/svg2png-many and the binary file is present in ./node_modules/svg2png-many/bin/index.js. You can run that file directly (instead of trying to use the symlink not created in ./node_modules/.bin)

Important note: when using Vagrant on Windows, in order for npm install to work, you have to

  • either run the console that starts vagrant up as administrator
  • or use the option --no-bin-links

The first is obviously the required solution here.

Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121
greuze
  • 4,250
  • 5
  • 43
  • 62
  • You are right, the `--no-bin-links` option was the culprit. But this was not the primary reason. According to https://stackoverflow.com/questions/24200333/symbolic-links-and-synced-folders-in-vagrant `vagrant up` must be run as administrator, in order for `npm install` to be able to create symlinks. – Lorenz Meyer May 29 '17 at 19:13