簡體   English   中英

我嘗試在環回 (strongloop) webapp 中安裝依賴項時出現 Npm 錯誤

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

我是 NodeJS 世界的新手。 我創建了一個環回(strongloop)webapp,但是在它之后我嘗試在應用程序的文件夾中運行npm install命令,我在終端中得到了這個輸出(Ubuntu server 14.04 withd newest updates - 在一個 vagrant 實例中)

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

這是由環回框架生成的package.json

{
  "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"
}

我嘗試使用sudo npm install運行,但得到了完全相同的結果。

版本:

  • 節點 v4.1.0
  • NPM v2.14.3
  • 流浪者 1.7.4
  • Ubuntu Server 14.04.3(帶有最新更新)

這是npm-log 文件,它很長。

如果您知道我的錯誤,請不要猶豫,只需回答:)

這是 Vagrant/VirtualBox 的問題。 不幸的是,同步/共享文件系統不支持符號鏈接。

如果你不需要這個功能,最簡單的方法就是在你的Vagrantfile禁用它:

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

如果您確實需要它,您現在可以找到解決方法,因為您知道這是符號鏈接支持的問題,npm 使用它來創建 bin :-)

有關更多詳細信息,請參閱https://docs.vagrantup.com/v2/synced-folders/basic_usage.html

發生錯誤是因為您掛載的共享目錄 (/vagrant) 位於不支持符號鏈接的文件系統上。

為了避免這個,你需要告訴npm你的文件系統不支持符號鏈接,例如

npm config set bin-links false

來源: npm 在 GH-7308 的 vagrant 中不起作用

或者通過為npm install指定--no-bin-links參數,這將阻止 npm 為包可能包含的任何二進制文件創建符號鏈接。


另一種方法是將其附加到您的package.json文件中,例如

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

如上所述,同步/共享文件系統不支持符號鏈接。

所以,你可以在你的 Windows 主機上安裝node.js並在主機代碼目錄中執行npm install

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM