简体   繁体   English

部署到 Azure 时,fsEvents 的 Npm 错误不受支持的平台

[英]Npm error unsupported platform for fsEvents when deploying to Azure

When I run npm install, I get this error:当我运行 npm install 时,出现此错误:

npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for
fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS:    darwin npm
ERR! notsup Valid Arch:  any npm ERR! notsup Actual OS:   win32 npm
ERR! notsup Actual Arch: x64

This has been asked here but the accepted answer that it is optional does not work for me as I am unable to publish to azure since npm install fails.这已被问到here,但接受的答案是可选的对我不起作用,因为我无法发布到 azure,因为 npm install 失败。

npm version : 5.6.0 npm 版本: 5.6.0

I have tried:我试过:

npm install --no-optional

npm i -f doesn't sound like a good idea... npm i -f 听起来不是个好主意...

Instead, add fsevents to optional dependencies (if fsevents is in your package.json):相反,将 fsevents 添加到可选依赖项(如果 fsevents 在您的 package.json 中):

"optionalDependencies": {
    "fsevents": "^2.0.7"
}

@Aaron is correct. @Aaron 是正确的。 This was failing when I was running npm install from within maven-frontend-plugin.当我从 maven-frontend-plugin 中运行 npm install 时,这失败了。

I resolved the issue using the command npm i -f ( npm install forced)我使用命令npm i -f (强制安装 npm)解决了这个问题

fsevents是一个仅限 OS X 的模块,您不能在 Windows 上安装它。

fsevents is only needed if you are building on a Mac.只有在 Mac 上构建时才需要 fsevents。 If you are deploying to ubuntu, windows, etc it's not needed.如果您要部署到 ubuntu、windows 等,则不需要。

See here npm package.json OS specific dependency which reads,在这里看到npm package.json 操作系统特定的依赖项,它读取,

npm package.json supports an os key, npm package.json 支持os键,

and also optionalDependencies以及可选的依赖项

os can be used to specify which OS a module can be installed on. os 可用于指定模块可以安装在哪个操作系统上。 optionalDependencies are module dependencies that if they cannot be installed, npm skips them and continues installing. optionalDependencies 是模块依赖项,如果它们无法安装,npm 会跳过它们并继续安装。

Either one will work.任何一个都会起作用。 I prefer adding the following to my package.json's root object:我更喜欢将以下内容添加到我的 package.json 的根对象中:

"optionalDependencies": {
    "fsevents": "^2.1.2",
  },

It is nothing to deal with Darwin or Windows .与 Darwin 或 Windows 无关。 You might have installed the Angular but system variable path is not updated accordingly .您可能已经安装了 Angular,但系统变量路径并未相应更新。

Get the ng install location from your system something like( C:\\Users.....\\AppData\\Roaming\\npm ) and add at the end of system variable path .从您的系统中获取 ng 安装位置,例如 ( C:\\Users.....\\AppData\\Roaming\\npm ) 并添加到系统变量 path 的末尾。

now go to Cmd -> type ng-v for Angular 6 ( ng v or ng version for Angular 7 ) .现在转到Cmd -> Angular 6 输入ng-v (Angular 7 输入ng vng 版本

I know this question is old, but for other people still facing this issue especially on mac0S, there seems to be some platform specificity issue around the whole thing.我知道这个问题很老,但对于其他人来说,尤其是在 mac0S 上仍然面临这个问题,整个事情似乎存在一些平台特异性问题。 I encountered the problem while trying to deploy to Heroku, I did the following, the build became successful and the deployment worked afterward.我在尝试部署到 Heroku 时遇到了问题,我执行了以下操作,构建成功并且部署成功。 So kindly do the following:因此,请执行以下操作:

  • Add your preferred version of fsevents to optionalDependencies in your package.json将您喜欢的fsevents版本添加到package.json optionalDependencies
  • Run npm install afterward.之后运行 npm install。
  • I assume you do not currently have an entry for optionalDependencies in your package.json , so here you go:我假设您目前在package.json没有optionalDependencies的条目,所以在这里您可以:

    "optionalDependencies": { "fsevents": "2.xx" }

This worked effortless for me on Windows:这在 Windows 上对我来说毫不费力:

Go to project's "package.lock.json" file Press "Ctrl+F" (to enable keyword search) Type "darwin" Wherever it says "darwin" in the file, change that to "win32" Restart your VS Code and you should be good to go.转到项目的“package.lock.json”文件按“Ctrl+F”(启用关键字搜索)键入“darwin”在文件中任何显示“darwin”的地方,将其更改为“win32”重新启动您的VS Code,您应该祝你好运。

When I run npm install, I get this error:当我运行npm install时,出现以下错误:

npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for
fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS:    darwin npm
ERR! notsup Valid Arch:  any npm ERR! notsup Actual OS:   win32 npm
ERR! notsup Actual Arch: x64

This has been asked here but the accepted answer that it is optional does not work for me as I am unable to publish to azure since npm install fails.这里已经有人问这个问题,但是可以接受的答案是可选的,这对我不起作用,因为npm install失败,所以我无法发布到azure。

npm version : 5.6.0 npm版本: 5.6.0

I have tried:我试过了:

npm install --no-optional

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM