在NPM文档中,有一个os option for platform specific dependency。
我的package.json包含fsevents,出于性能考虑,这是MacOS上必须使用的。另一方面,它会在Windows上导致错误。
"dependencies": {
"axios": "^0.17.0",
"electron": "^1.6.11",
"electron-packager": "^8.7.2",
"electron-reload": "^1.2.2",
"electron-store": "^1.3.0",
"flatpickr": "^4.0.7",
"fsevents": "^1.1.2",那么,我到底应该如何使用os选项呢?
发布于 2017-11-14 18:32:40
它的工作我试过了
添加到您的package.json:
"scripts": {
"install": "node install_dependencies.js"
}然后添加一个install_dependencies.js文件来检查运行npm install的操作系统。
发布于 2017-11-14 18:50:42
fsevents应该是一个可选的依赖项,它会在安装过程中发出警告,但不会出现错误。您使用的是哪个版本的npm?请尝试升级。至少有几个错误版本的npm会打破这一点。
https://github.com/npm/npm/releases/tag/v3.10.10
REGRESSION FIX: 9aebe98 #14117 Fixes a bug where installing a shrinkwrapped
package would fail if the platform failed to install an optional dependency
included in the shrinkwrap.https://github.com/npm/npm/releases/tag/v5.4.2
0b28ac72d #18458 Fix a bug on Windows where rolling back of failed optional
dependencies would fail.https://stackoverflow.com/questions/47282659
复制相似问题