繁体   English   中英

还有其他人收到此错误吗? .... 错误:std::bad_alloc... 错误:作业失败退出代码 1 部署 Gatsby 站点

[英]Anyone else getting this error? .... Error: std::bad_alloc ... ERROR: job failed exit code 1 deploying Gatsby site

我是 gatsby 的新手,不确定为什么会收到此错误:

Error: std::bad_alloc... ERROR: job failed exit code 1. 它发生在执行命令gatsby build之后。

**这是我的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."

**这是 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$ 

`

仍然收到此错误。

我建议将此问题标记为Why clean install of Gatsby throws warnings for react-server-dom-webpack 的副本 一位男士在 Gatsby GitHub 页面上提出了与这些警告相关的官方问题,并收到了 Gatsby 团队成员的官方回复,该问题与 react-server-dom-webpack 的实验性构建有关盖茨比用于部分水化。 可以在此处找到对此事的官方评论

暂无
暂无

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

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