NPM 安装失败 - fsevents

NPM Install fails - fsevents

我无法在我的 laravel 项目中正确安装 npm。我在 vag运行t 盒子 (ubuntu-trusty-64) 上 运行ning laravel。当我 运行 'npm install' 我在我的 pastebin 中得到第一个错误(链接如下)。然后我在下面的某个地方发现,当在 windows host os 上使用 vag运行t 框时,我应该 运行 它没有符号链接,所以我 运行 'npm install --no-bin-links' 我仍然遇到第一个错误。因此,在一些帮助下,我 运行 'rm -rf node_modules' 然后 运行 'npm install --no-bin-links' 它似乎工作但挂起看到 pastebin 的后半部分。

请帮忙!

pastebin:https://pastebin.com/wuRkjqi6

更新:

为了更新大家的状态,我完全删除了 npm 并重新安装如下:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

对于node.js 8

然后我 运行 'sudo npm install --no-bin-links --verbose' 直接从 host 虚拟机通过 virtualbox 绕过 vag运行t ssh;但它仍然轰炸我;这次有一个错误。但仍然围绕着 fsevents。

27990 info lifecycle vue@2.4.2~postinstall: vue@2.4.2
27991 verbose unlock done using /home/vagrant/.npm/_locks/staging-71408633a969dee2.lock for /home/vagrant/projects/MusekClub/node_modules/.staging
27992 verbose stack Error: ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules'
27993 verbose cwd /home/vagrant/projects/MusekClub
27994 verbose Linux 3.13.0-125-generic
27995 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--no-bin-links" "--verbose"
27996 verbose node v8.2.1
27997 verbose npm  v5.3.0
27998 error path /home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules
27999 error code ETXTBSY
28000 error errno -26
28001 error syscall rmdir
28002 error ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules'
28003 verbose exit [ -26, true ]

最后,我今天早上尝试从头开始重建 vag运行t 框,当我从 virtualbox host 重新运行 'sudo npm install --no-bin-links --verbose' 时,我得到了以下:

vagrant@vagrant-ubuntu-trusty-64:~/projects/MusekClub$ sudo npm install
npm ERR! path /home/vagrant/projects/MusekClub/node_modules/fsevents/build/Release/.deps/User/eshanker/Code/fsevents/lib
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rmdir
npm ERR! ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/build/Release/.deps/Users/eshanker/Code/fsevents/lib'

npm ERR! A complete log of this run can be found in:
npm ERR!    /home/vagrant/.npm/_logs/2017-08-09T12_45_58_590Z-debug.log

我从默认 laravel 5.4 package.json 文件中删除了标准依赖项。然后我一一安装。我发现我的问题仅在安装 "laravel-mix": "^1.0" 依赖行时出现。

我可以通过放弃 npm 并使用 yarn 来解决我的问题。似乎通过 fsevents 模块将其作为可选依赖项读取。根据我的研究,linux 似乎不支持 fsevents。

vagrant@vagrant-ubuntu-trusty-64:~/projects/MusekClub$ sudo yarn install
yarn install v0.27.5
    Resolving packages...
    Fetching packages...
warning fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check.
Excluding it from installation.
    Linking dependencies...
    Building fresh packages...
Done in 67.15s.

使用 vagrant 我能够通过删除 --node-bin-links 和 运行 我的 vagrant box 作为管理员来解决这个问题。我使用的 node 和 npm 的版本大致相同。

npm install --no-optional帮助了我,但只是在回避问题。