【问题标题】:fsevents (pulled in by chokidar) in npm shrinkwrap causes build to fail on Windowsnpm shrinkwrap 中的 fsevents(由 chokidar 引入)导致构建在 Windows 上失败
【发布时间】:2016-11-25 13:08:56
【问题描述】:

仅 OSX 的 fsevents 列在 npm shrinkwrap 中,因为它是由 chokidar 拉入的。我们的产品是基于 Linux 的,它在那里没有造成任何问题,显然 OSX 开发人员也很好,但它在我的 Win x64 环境中破坏了npm install

我该如何解决这个问题?

C:\Users\User\Documents\splive>npm install
(node:2888) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

> fsevents@1.0.8 install C:\Users\User\Documents\splive\node_modules\fsevents
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.8/fse-v1.0.8-node-v48-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.0.8 and node@6.3.0 (node-v48 ABI) (falling back to source compile with node-gyp)
Traceback (most recent call last):
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2003, in GenerateOutput
    sln_projects, project_objects, flat=msvs_version.FlatSolution())
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1762, in _GatherSolutionFolders
    return _DictsToFolders('', root, flat)
  File "C:\Users\User\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1715, in _DictsToFolders
    for folder, contents in bucket.iteritems():
AttributeError: 'MSVSProject' object has no attribute 'iteritems'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\User\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 10.0.14388
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\User\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\User\\Documents\\splive\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64\\fse.node" "--module_name=fse" "--module_path=C:\\Users\\User\\Documents\\splive\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64" "--python=C:\\Python27\\python.exe" "--msvs_version=2015"
gyp ERR! cwd C:\Users\User\Documents\splive\node_modules\fsevents
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Users\User\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\User\Documents\splive\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64\fse.node --module_name=fse --module_path=C:\Users\User\Documents\splive\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64 --python=C:\Python27\python.exe --msvs_version=2015' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\User\Documents\splive\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:852:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
node-pre-gyp ERR! System Windows_NT 10.0.14388
node-pre-gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\User\\Documents\\splive\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\User\Documents\splive\node_modules\fsevents
node-pre-gyp ERR! node -v v6.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.29
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Users\User\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\User\Documents\splive\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64\fse.node --module_name=fse --module_path=C:\Users\User\Documents\splive\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64 --python=C:\Python27\python.exe --msvs_version=2015' (1)
npm WARN install:fsevents@1.0.8 fsevents@1.0.8 install: `node-pre-gyp install --fallback-to-build`
npm WARN install:fsevents@1.0.8 Exit status 1

完整输出:http://pastebin.com/WNy0pmqK

有人遇到过吗?如何克服?


关于我的系统的信息:

我现在正在使用 Node.js 6.4(尝试升级表单 5.3,所以它可能会有所帮助)。 Npm 版本是 3.10.5,尽管我尝试降级到 3.3.12,因为某些 npm 问题表明了这一点。我正在使用 x64 Win 10 Insider 最新的慢速环版本。


这可能是相关的,但没有一个解决方案有效,而且这与收缩包装无关:node-gyp build error windows x64

可能是相关的 git 问题:

【问题讨论】:

  • 现在即使我从收缩包装中手动删除 fsevent 也会失败。 Chokidar 也是一个可传递的包。任何人都知道如何处理这个问题?现在大家都在用 Mac 吗?
  • 如果您遇到同样的问题,请评论您的节点、npm 版本和系统,以便我们找出一些模式。
  • 这个fsevents 在 Linux 上也很受欢迎。可笑,Mac 就像瘟疫一样
  • 我在使用 Node 8.9.4 / npm 5.6.0 的 Windows 7 上遇到了这个确切的问题。这个项目的任何地方都没有使用 Mac 或 Linux。 “npm install” 不会安装 fsevents,但会将其添加到 shrinkwrap 文件中。如果我检查该更改,它会导致 npm install 在构建服务器上失败。

标签: node.js npm fsevents windows-10-desktop npm-shrinkwrap


【解决方案1】:

使用npm install --no-optional 来安装您的软件包,而无需将fsevents 添加到shrinkwrap 文件中。 (如果那里已经有对fsevents 的引用,请手动删除它们。)

我通过另一个 Stack Overflow 问题发现了这个选项:error fsevents@1.0.14 in windows 7

【讨论】:

  • 这看起来是个不错的解决方案,但不幸的是,过去 2 年多以来我的主要操作系统又是 Linux,所以我无法对此进行测试。尽管fsevents 也不兼容Linux,但我还没有在Linux 上遇到过这个具有完全相同代码库的特定代码。所以理论上它也应该是一个问题,但它从未实现。
猜你喜欢
  • 2017-02-22
  • 1970-01-01
  • 2018-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-10
  • 2018-04-22
  • 2015-09-04
相关资源
最近更新 更多