简体   繁体   English

Gatsby 云部署构建错误:无法从 webpack-dev-server:fsevents 访问绑定

[英]Gatsby cloud deploy build error: bindings not accessible from webpack-dev-server:fsevents

I'm working on a Gatsby site.我在 Gatsby 网站上工作。 Currently I've got it building just fine locally, but when I try to deploy to Gatsby Cloud, it fails during "install project dependencies", with the Raw Logs showing this:目前我已经在本地构建得很好,但是当我尝试部署到 Gatsby Cloud 时,它在“安装项目依赖项”期间失败,原始日志显示:

17:39:24 PM:
Cloning into '/usr/src/app/www'...

17:39:29 PM:
npm ERR! bindings not accessible from webpack-dev-server:fsevents

17:39:29 PM:
npm

17:39:29 PM:
 ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-19T23_39_29_074Z-debug.log

17:39:29 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/

17:39:29 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit attempt 1 of 3...

17:39:31 PM:
npm

17:39:31 PM:
 ERR! bindings not accessible from webpack-dev-server:fsevents

17:39:31 PM:
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-19T23_39_31_076Z-debug.log

17:39:31 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/

17:39:31 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ attempt 2 of 3...

17:39:33 PM:
npm

17:39:33 PM:
 ERR! bindings not accessible from webpack-dev-server:fsevents

17:39:33 PM:
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-19T23_39_33_080Z-debug.log

17:39:33 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/

17:39:33 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ attempt 3 of 3...

17:39:35 PM:
npm

17:39:35 PM:
 ERR! bindings not accessible from webpack-dev-server:fsevents

17:39:35 PM:
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-19T23_39_35_038Z-debug.log

17:39:35 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/

17:39:35 PM:
ERROR Failed to compile: Error: Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/

I'm on a Linux (Ubuntu) OS.我在 Linux (Ubuntu) 操作系统上。 Node version 14.16.0.节点版本 14.16.0。

Even though the error doesn't seem to indicate that the build failed from fsevents not being present (rather that fsevent couldn't access 'bindings'--which is a term I'm pretty lost on, honestly), I did try installing fsevent locally, it failed (not surprisingly because it seems to be for MacOS).即使错误似乎并不表明构建失败,因为 fsevents 不存在(而是 fsevent 无法访问“绑定”——老实说,这是一个我很迷失的术语),我确实尝试安装fsevent 在本地,它失败了(并不奇怪,因为它似乎适用于 MacOS)。 But I also tried manually placing it in either the dependencies and devDependencies of my package.json (my thought being that the cloud server would install it).但我也尝试将它手动放置在我的 package.json 的依赖项和 devDependencies 中(我认为云服务器会安装它)。 That did not work either.那也没有用。

I'm pretty lost on this one, any help would be appreciated.我对这个很迷茫,任何帮助将不胜感激。 I'm also not sure where I go to get the complete logs as referenced in the Raw Log above.我也不确定从哪里获取上面原始日志中引用的完整日志。 I'll update if I find those so, if I haven't uploaded them yet, any help on where to go to get those would be appreciated.如果我找到这些,我会更新,如果我还没有上传它们,任何关于去哪里获取这些的帮助将不胜感激。

Thanks谢谢

Assuming that the site builds locally as you said, the issue to me seems to be related to a mismatching of Node versions between environments (your local machine and Gatsby Cloud).假设该站点如您所说的那样在本地构建,对我而言,问题似乎与环境(您的本地机器和 Gatsby Cloud)之间的 Node 版本不匹配有关。

According to the Environment Variables Specific to Gatsby Cloud docs, you can specify the Node version by setting a NODE_VERSION environment variable, which by default is set to 12:根据Gatsby Cloud文档的特定环境变量,您可以通过设置NODE_VERSION环境变量来指定节点版本,默认设置为 12:

NODE_VERSION : Specify the version of Node.js your project should use. NODE_VERSION :指定您的项目应使用的 Node.js 版本。 For example, NODE_VERSION=10 .例如, NODE_VERSION=10 Defaults to 12.默认为 12。

In your case, use a node -v locally to get your Node version and set the NODE_VERSION accordingly.在您的情况下,请在本地使用node -v来获取您的 Node 版本并相应地设置NODE_VERSION This will force the cloud to use the same version as local, hence the same exact working versions.这将强制云使用与本地相同的版本,因此完全相同的工作版本。


Further revisions to this topic bypassed the issue by removing the package-lock.json and ignoring it (adding it to .gitignore ) to let Gatsby Cloud install the dependencies in their own environment.本主题的进一步修订通过删除package-lock.json并忽略它(将其添加到.gitignore )来绕过该问题,让 Gatsby Cloud 在自己的环境中安装依赖项。

The Gatsby Cloud support suggested to delete the package-lock.json file. Gatsby Cloud 支持建议删除package-lock.json文件。 And that fixed the problem for me!这为我解决了问题!

You need to make sure to also include package-lock.json into your .gitignore file in order to prevent it from being uploaded to GitHub the next time you build on your own machine.您还需要确保将package-lock.json到您的.gitignore文件中,以防止下次在您自己的机器上构建时将其上传到 GitHub。

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

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