Npm errors while I try to install dependencies in loopback (strongloop) webapp

I am new in the NodeJS world. I have created an loopback(strongloop) webapp, but after it I try to run the npm install command in the application's folder I get this output in the terminal (Ubuntu server 14.04 withd newest updates - in a vagrant instance)

vagrant@vagrant-ubuntu-trusty-64:/vagrant/example-app$ npm install
npm WARN package.json [email protected] No license field.
npm WARN optional dep failed, continuing [email protected]
npm WARN deprecated [email protected]: use JSONStream instead
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm ERR! Linux 3.13.0-62-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.1.0
npm ERR! npm  v2.14.3
npm ERR! path ../node-uuid/bin/uuid
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! syscall symlink

npm ERR! EPROTO: protocol error, symlink '../node-uuid/bin/uuid' -> '/vagrant/example-app/node_modules/loopback-datasource-juggler/node_modules/.bin/uuid'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 3.13.0-62-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.1.0
npm ERR! npm  v2.14.3
npm ERR! path npm-debug.log.2d5bb41273f18b2da30958b9aa61bfe6
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename

npm ERR! ETXTBSY: text file is busy, rename 'npm-debug.log.2d5bb41273f18b2da30958b9aa61bfe6' -> 'npm-debug.log'
npm ERR!

npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/example-app/npm-debug.log

This is the generated package.json which has been generated by loopback framework:

{
  "name": "example-app",
  "version": "1.0.0",
  "main": "server/server.js",
  "scripts": {
    "pretest": "jshint ."
  },
  "dependencies": {
    "compression": "^1.0.3",
    "cors": "^2.5.2",
    "loopback": "^2.22.0",
    "loopback-boot": "^2.6.5",
    "loopback-datasource-juggler": "^2.39.0",
    "serve-favicon": "^2.0.1"
  },
  "optionalDependencies": {
    "loopback-explorer": "^1.1.0"
  },
  "devDependencies": {
    "jshint": "^2.5.6"
  },
  "repository": {
    "type": "",
    "url": ""
  },
  "description": "example-app"
}

I have tried to run with sudo npm install but I have gotten exactly the same result.

Versions:

Here is the npm-log file, it's very long.

If you know my mistake, do not hesitate, just answer :)

Upvotes: 1

Views: 2863

Answers (3)

Max
Max

Reputation: 21

As said above, the synced/shared filesystem doesn't support symlinks.

SO, you can install node.js on your Windows host and execute npm install in the host code directory

Upvotes: 0

kenorb
kenorb

Reputation: 166349

The error happens, because your mounted shared directory (/vagrant) is on file system which doesn't support symbolic links.

To void this, you need to tell npm that your file system doesn't support symbolic links, e.g.

npm config set bin-links false

Source: npm doesn't work in vagrant at GH-7308

or by specifying --no-bin-links argument for npm install which will prevent npm from creating symlinks for any binaries the package might contain.


Alternative way is to append this to your package.json file, e.g.

"config": {
  "bin-links": false
},

Upvotes: 1

Ryann Graham
Ryann Graham

Reputation: 8229

This is a problem with Vagrant/VirtualBox. Unfortunately, the synced/shared filesystem doesn't support symlinks.

If you don't require this functionality, the easiest thing to do is to just disable it in your Vagrantfile:

# ...
config.vm.synced_folder ".", "/vagrant", disabled: true
# ...

If you do require it, you may be able to find a work around now that you know it is a problem with symlink support, which npm uses for creating bins :-)

See https://docs.vagrantup.com/v2/synced-folders/basic_usage.html for more details.

Upvotes: 4

Related Questions