npm install
命令 -
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\rea
ct-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch
okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
警告显然导致我们的Jenkins Job标记失败,所以我们只是试图摆脱同样的错误。
我已经检查了这个https://stackoverflow.com/a/42938398/351903 但是,与那里提到的不同,我的设置中没有任何/ node_modules / fserrors。另外,我的package.json不包含fserrors。以下是我的package.json -
{
"name": "mvc-panel",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"jquery": "^3.2.1",
"material-ui": "^0.18.3",
"qs": "^6.4.0",
"react": "^15.5.4",
"react-alert": "^2.1.2",
"react-bootstrap-table": "^3.4.1",
"react-dom": "^15.5.4",
"react-loader": "^2.4.2",
"react-router-dom": "^4.1.1",
"react-tap-event-plugin": "^2.0.1",
"serve": "^6.0.0"
},
"devDependencies": {
"datatables.net": "^1.10.15",
"jquery": "^3.2.1",
"react-scripts": "^1.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我可以在node_modules\react-scripts\package.json
-
{
"_args": [
[
{
"raw": "react-scripts@^1.0.7",
"scope": null,
"escapedName": "react-scripts",
"name": "react-scripts",
"rawSpec": "^1.0.7",
"spec": ">=1.0.7 <2.0.0",
"type": "range"
},
"D:\\Sandeepan\\Payu MVC\\backend codebase\\MVC2.0\\panel\\mvc-panel"
]
],
"_from": "react-scripts@>=1.0.7 <2.0.0",
"_id": "react-scripts@1.0.14",
"_inCache": true,
"_location": "/react-scripts",
"_nodeVersion": "8.5.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/react-scripts-1.0.14.tgz_1506471610836_0.5613740666303784"
},
"_npmUser": {
"name": "timer",
"email": "timer150@gmail.com"
},
"_npmVersion": "5.3.0",
"_phantomChildren": {
"asap": "2.0.6",
"escape-string-regexp": "1.0.5",
"graceful-fs": "4.1.11",
"has-ansi": "2.0.0",
"universalify": "0.1.1"
},
"_requested": {
"raw": "react-scripts@^1.0.7",
"scope": null,
"escapedName": "react-scripts",
"name": "react-scripts",
"rawSpec": "^1.0.7",
"spec": ">=1.0.7 <2.0.0",
"type": "range"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-1.0.14.tgz",
"_shasum": "70fe76c9beb67b136b953e875bdfe4ad78d410d1",
"_shrinkwrap": null,
"_spec": "react-scripts@^1.0.7",
"_where": "D:\\Sandeepan\\Payu MVC\\backend codebase\\MVC2.0\\panel\\mvc-panel",
"bin": {
"react-scripts": "./bin/react-scripts.js"
},
"bugs": {
"url": "https://github.com/facebookincubator/create-react-app/issues"
},
"dependencies": {
"autoprefixer": "7.1.2",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-preset-react-app": "^3.0.3",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
"dotenv": "4.0.0",
"eslint": "4.4.1",
"eslint-config-react-app": "^2.0.1",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.2",
"fs-extra": "3.0.1",
"fsevents": "1.1.2",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.6",
"promise": "8.0.1",
"react-dev-utils": "^4.1.0",
"style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.5.9",
"webpack": "3.5.1",
"webpack-dev-server": "2.8.2",
"webpack-manifest-plugin": "1.2.1",
"whatwg-fetch": "2.0.3"
},
"description": "Configuration and scripts for Create React App.",
"devDependencies": {
"react": "^15.5.4",
"react-dom": "^15.5.4"
},
"directories": {},
"dist": {
"integrity": "sha512-+p0q2N2WW7L4WW6uObqN7fYwSQZ9fBI0StpMYl1Ukoz/lCbemf+yW6b8refyhTsGy62GAqxlpyEfVcTE3hJAxg==",
"shasum": "70fe76c9beb67b136b953e875bdfe4ad78d410d1",
"tarball": "https://registry.npmjs.org/react-scripts/-/react-scripts-1.0.14.tgz"
},
"engines": {
"node": ">=6"
},
"files": [
"bin",
"config",
"scripts",
"template",
"utils"
],
"homepage": "https://github.com/facebookincubator/create-react-app#readme",
"license": "MIT",
"maintainers": [
{
"name": "timer",
"email": "timer150@gmail.com"
},
{
"name": "fb",
"email": "opensource+npm@fb.com"
},
{
"name": "gaearon",
"email": "dan.abramov@gmail.com"
}
],
"name": "react-scripts",
"optionalDependencies": {
"fsevents": "1.1.2"
},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/facebookincubator/create-react-app.git"
},
"version": "1.0.14"
}
更新
我尝试运行npm install命令并获取先前命令的退出状态。尽管有警告,但它显示了0意味着成功。所以,看起来詹姆斯的工作不应该因此而陷入困境。但是,我们仍在努力寻找摆脱此警告的方法,因为它与我们的操作系统无关。
答案 0 :(得分:38)
fsevents
在mac和其他linux系统中的处理方式不同。 Linux系统忽略fsevents
而mac安装它。由于上面的错误消息指出npm install --no-optional
是可选的,因此在安装过程中会跳过它。
您可以在linux系统中运行{{1}}命令以避免上述警告。
更多信息
答案 1 :(得分:9)
npm i -f
我想重新发布this thread的一些评论,您可以在这些评论中阅读该问题并问题已解决。
这正是Angular的问题。当前的package.json需要fsevent 不是optionalDependencies而是devDependencies。这可能是个问题 对于非OSX用户。
有时
即使你从package.json npm中删除它我仍然失败,因为 另一个模块将它作为对等部门。
所以
如果npm-shrinkwrap.json仍然存在,请将其删除或尝试npm i -f
答案 2 :(得分:4)
如果要隐藏此警告,则只需安装fsevents作为可选依赖项。 只需执行:
npm i fsevents@latest -f --save-optional
..并且警告也不再麻烦。
答案 3 :(得分:3)
答案 4 :(得分:2)
npm v7 不再发生这种情况。您可以更新您的 npm 版本或更新到 node v15 或更高版本,默认情况下会安装 npm v7。
答案 5 :(得分:2)
我们可以将其添加到npm或yarn配置中,而不是每次使用--no-optional
。
对于Yarn,有一个默认的非可选配置,因此我们可以对其进行编辑:
yarn config set ignore-optional true
对于npm,没有默认配置设置,因此我们可以创建一个:
npm config set ignore-optional true
答案 6 :(得分:2)
我在Ubuntu中也遇到了同样的问题。
解决这个问题。
npm install -g yarn
npm install yarn
yarn install
yarn upgrade
如果您使用angular / cli,也要这样做
ng update
答案 7 :(得分:1)
我在使用MacOS时也遇到了同样的问题。问题是一种错误。我通过重复运行命令来解决了这个问题,
sudo npm cache clean --force
sudo npm uninstall
sudo npm install
有一次它不起作用,但是当我反复清理缓存并卸载npm后,重新安装npm时,错误消失了。我正在使用Angular 8,这个问题很常见
答案 8 :(得分:1)
我正在使用, Angular CLI:8.1.2 节点:12.14.1 操作系统:win32 x64
奇怪的是,这对我有帮助
npm cache clean --force
npm uninstall @angular/cli
npm install @angular/cli@8.1.2
答案 9 :(得分:0)
我发现了相同的问题,并尝试了上面和github中提到的所有解决方案。当我使用travic-CI或Pipelines将我的PR推送到远程存储库中时,有些只能在本地存储库中工作,这会给我同样的错误。最后,我使用下面的npm命令修复了该问题。
npm audi fix --force
答案 10 :(得分:0)
我在Linux系统(Ubuntu)上遇到此错误,这可能在您运行时发生:
npm安装
1)如果本地磁盘/计算机中没有该项目,请将其复制到计算机中,然后重试。这样您就获得了访问文件夹的权限(只需确保您具有访问权限即可)。
2)如果仍然收到一些警告或错误,请运行:
npm审核修复程序
这将解决依赖项中的漏洞,并通过提供易于运行的npm命令和建议以进行进一步的故障排除,来帮助您修复漏洞。
希望有帮助!
答案 11 :(得分:0)
package.json
用optionalDependencies
键计数。
NPM on Optional Dependencies。
您可以向该对象添加fsevents
,如果发现自己在与MacOS不同的平台上安装软件包,则 yarn 或会跳过fsevents
npm 。
"optionalDependencies": {
"fsevents": "2.1.2"
},
您将在安装日志中找到以下消息:
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
希望有帮助!
答案 12 :(得分:0)
如果有人因为离线cordova安装而出现此错误。只需在cmd中使用此代码npm install --no-optional
即可。
然后运行此代码npm install -g ionic@latest cordova
答案 13 :(得分:0)
我得到了同样的错误。就我而言,我使用映射驱动器来编辑第二台计算机的代码,该计算机正在运行linux。不确定为什么gulp-watch在安装之前依赖于操作系统兼容性(我认为它与安全性有关)。本质上,错误是检查操作系统和操作系统调用节点模块,在我的情况下,两个操作系统不一样,所以它抛出错误。从你的错误看起来与我的相同。
错误
Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
我是如何修理的?
我直接登录linux计算机并运行
npm install --save-dev <module-name>
然后回到我的编码环境中,之后一切都很好。
希望有所帮助!
答案 14 :(得分:0)
我通过删除 node_modules
文件夹并运行 npm i
解决了这个问题。
答案 15 :(得分:0)
是的,使用命令npm install --no-optional
时,它可以正常工作
使用环境:
答案 16 :(得分:0)
答案 17 :(得分:-1)
答案 18 :(得分:-5)
使用app.UseEndpoints(...);
。