[英]Anyone else getting this error? .... Error: std::bad_alloc ... ERROR: job failed exit code 1 deploying Gatsby site
I am new to gatsby and not sure why I am getting this error:我是 gatsby 的新手,不确定为什么会收到此错误:
Error: std::bad_alloc... ERROR: job failed exit code 1. It occurs after the command gatsby build
is executed.. Error: std::bad_alloc... ERROR: job failed exit code 1. 它发生在执行命令gatsby build
之后。
**Here is my gitlab-ci.yml
(in Visual Studio) ** **这是我的gitlab-ci.yml
(在 Visual Studio 中)**
`stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-website: # This job runs in the build stage, which runs first.
stage: build
image: node:latest
script:
- echo "Compiling the code..."
- npm install
- npm install -g gatsby-cli
- gatsby build --verbose
artifacts:
paths:
- public
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
**Here is the output and Error: ** **这是 output 和错误:**
`Running with gitlab-runner 15.7.1 (6d480948)
on TODDs-iMac.local 2swxxWzH
Preparing the "docker" executor
00:02
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:548714e444f4d0c77d9a6bd243b10715663c73425b28ca648a224f5e31510882 for node:latest with digest node@sha256:d5222e1ebd7dd7e9683f47a8861a4711cb4407a4830cbe04a582ca4986245700 ...
Preparing environment
00:01
Running on runner-2swxxwzh-project-41617098-concurrent-0 via TODDs-iMac.local...
Getting source from Git repository
00:05
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/Toddrickson/my-static-website/.git/
Checking out a69c6eb5 as main...
Removing .cache/compiled/
Removing node_modules/.bin/ansi-html
Removing node_modules/@lmdb/lmdb-linux-x64/
Removing node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/
Removing node_modules/@parcel/cache/node_modules/@lmdb/lmdb-linux-x64/
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:35
Using docker image sha256:548714e444f4d0c77d9a6bd243b10715663c73425b28ca648a224f5e31510882 for node:latest with digest node@sha256:d5222e1ebd7dd7e9683f47a8861a4711cb4407a4830cbe04a582ca4986245700 ...
$ echo "Compiling the code..."
Compiling the code...
$ npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN react@"^18.2.0" from the root project
npm WARN 7 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react-server-dom-webpack
npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.2.0
npm WARN node_modules/gatsby
npm WARN
npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react-server-dom-webpack
npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.2.0
npm WARN node_modules/gatsby
added 3 packages, changed 1 package, and audited 1363 packages in 9s
212 packages are looking for funding
run `npm fund` for details
14 vulnerabilities (1 low, 12 moderate, 1 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
$ npm install -g gatsby-cli
added 328 packages in 18s
53 packages are looking for funding
run `npm fund` for details
$ gatsby build --verbose
verbose 0.689606309 set gatsby_log_level: "verbose"
verbose 0.691542062 set gatsby_executing_command: "build"
verbose 0.692319145 loading local command from: /builds/Toddrickson/my-static-website/node_modules/gatsby/dist/commands/build.js
verbose 3.321975841 running command: build
verbose 3.323810293 Running build in "production" environment
error There was an unhandled error during compilation for /builds/Toddrickson/my-static-website. Please run the command with the --verbose flag again.
std::bad_alloc
Error: std::bad_alloc
not finished compile gatsby files - 0.140s
ERROR: Job failed: exit code 1`
`
**tried making updates .....**
`TODDs-iMac:~ Toddrickson$ docker --version
Docker version 20.10.21, build baeda1f
TODDs-iMac:~ Toddrickson$ gitlab-runner --version
Version: 15.7.1
Git revision: 6d480948
Git branch: 15-7-stable
GO version: go1.18.9
Built: 2022-12-19T12:29:15+0000
OS/Arch: darwin/amd64
TODDs-iMac:~ Toddrickson$ npm --version
8.19.2
TODDs-iMac:~ Toddrickson$ gatsby --version
Gatsby CLI version: 5.1.0
TODDs-iMac:~ Toddrickson$
` `
Still getting this error.仍然收到此错误。
I would suggest this question be marked as a duplicate of Why clean install of Gatsby throws warnings for react-server-dom-webpack .我建议将此问题标记为Why clean install of Gatsby throws warnings for react-server-dom-webpack 的副本。 It was answered by a man who raised an official issue on Gatsby GitHub page related to those warnings and received an official response by a member of Gatsby team that this issue has everything to do with an experimental build of react-server-dom-webpack which Gatsby is using for Partial Hydration.一位男士在 Gatsby GitHub 页面上提出了与这些警告相关的官方问题,并收到了 Gatsby 团队成员的官方回复,该问题与 react-server-dom-webpack 的实验性构建有关盖茨比用于部分水化。 The official comment on the matter can be found here 可以在此处找到对此事的官方评论
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.