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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 01:22:32

问题


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 example-app@1.0.0 No license field.
npm WARN optional dep failed, continuing ycssmin@1.0.1
npm WARN deprecated jsonstream@1.0.3: use JSONStream instead
npm WARN optional dep failed, continuing request@2.62.0
npm WARN optional dep failed, continuing loopback-explorer@1.8.0
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:

  • Node v4.1.0
  • Npm v2.14.3
  • Vagrant 1.7.4
  • Ubuntu Server 14.04.3 (with the newest updates)

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

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


回答1:


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.




回答2:


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
},



回答3:


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



来源:https://stackoverflow.com/questions/32666983/npm-errors-while-i-try-to-install-dependencies-in-loopback-strongloop-webapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!