Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

915
Visualizações
Gatsby deployment failure on AWS Amplify

I have a gatsby portfolio page that's simply all in an index.js file.

I am having trouble deploying it on AWS Amplify, here are the build logs:

                                 # Starting phase: preBuild
                                 # Executing command: npm install
2021-11-02T07:59:54.079Z [INFO]: > msgpackr-extract@1.0.15 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/msgpackr-extract
                                 > node-gyp-build
2021-11-02T07:59:54.283Z [INFO]: > lmdb-store@1.6.11 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/lmdb-store
                                 > node-gyp-build
2021-11-02T07:59:54.534Z [INFO]: > core-js@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js
                                 > node -e "try{require('./postinstall')}catch(e){}"
2021-11-02T07:59:54.582Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
                                 [96mThe project needs your help! Please consider supporting of core-js:[0m
                                 [96m>[94m https://opencollective.com/core-js [0m
                                 [96m>[94m https://patreon.com/zloirock [0m
                                 [96m>[94m https://paypal.me/zloirock [0m
                                 [96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
                                 [96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
2021-11-02T07:59:54.588Z [INFO]: > core-js-pure@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js-pure
                                 > node -e "try{require('./postinstall')}catch(e){}"
2021-11-02T07:59:54.942Z [INFO]: > gatsby-telemetry@3.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-telemetry
                                 > node src/postinstall.js || true
2021-11-02T07:59:55.003Z [INFO]: > gatsby-cli@4.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-cli
                                 > node scripts/postinstall.js
2021-11-02T07:59:55.057Z [INFO]: > gatsby@4.0.1 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby
                                 > node scripts/postinstall.js
2021-11-02T07:59:56.402Z [WARNING]: npm
2021-11-02T07:59:56.403Z [WARNING]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
                                    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2021-11-02T07:59:56.407Z [INFO]: added 1667 packages from 742 contributors and audited 1668 packages in 46.524s
2021-11-02T07:59:57.367Z [INFO]: 290 packages are looking for funding
                                 run `npm fund` for details
2021-11-02T07:59:57.369Z [INFO]: found 17 vulnerabilities (7 moderate, 9 high, 1 critical)
                                 run `npm audit fix` to fix them, or `npm audit` for details
2021-11-02T07:59:57.437Z [INFO]: # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: npm run build
2021-11-02T07:59:57.634Z [INFO]: > new-portfolio@1.0.0 build /codebuild/output/src648320162/src/simonshampoo.io
                                 > gatsby build
2021-11-02T07:59:58.185Z [WARNING]: error Gatsby requires Node.js 14.15.0 or higher (you have v12.21.0).
                                    Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
2021-11-02T07:59:58.502Z [WARNING]: npm
2021-11-02T07:59:58.502Z [WARNING]: ERR! code ELIFECYCLE
                                    npm ERR! errno 1
2021-11-02T07:59:58.504Z [WARNING]: npm
2021-11-02T07:59:58.505Z [WARNING]: ERR! new-portfolio@1.0.0 build: `gatsby build`
                                    npm ERR! Exit status 1
                                    npm ERR!
                                    npm ERR! Failed at the new-portfolio@1.0.0 build script.
                                    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-11-02T07:59:58.509Z [WARNING]: 
2021-11-02T07:59:58.510Z [WARNING]: npm ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2021-11-02T07_59_58_505Z-debug.log
2021-11-02T07:59:58.510Z [HELP]: Outputting the npm debug log
                                 0 info it worked if it ends with ok
                                 1 verbose cli [
                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/node',
                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/npm',
                                 1 verbose cli   'run',
                                 1 verbose cli   'build'
                                 1 verbose cli ]
                                 2 info using npm@6.14.11
                                 3 info using node@v12.21.0
                                 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
                                 5 info lifecycle new-portfolio@1.0.0~prebuild: new-portfolio@1.0.0
                                 6 info lifecycle new-portfolio@1.0.0~build: new-portfolio@1.0.0
                                 7 verbose lifecycle new-portfolio@1.0.0~build: unsafe-perm in lifecycle true
                                 8 verbose lifecycle new-portfolio@1.0.0~build: PATH: /root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src648320162/src/simonshampoo.io/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v12.21.0/bin:/root/.local/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
                                 9 verbose lifecycle new-portfolio@1.0.0~build: CWD: /codebuild/output/src648320162/src/simonshampoo.io
                                 10 silly lifecycle new-portfolio@1.0.0~build: Args: [ '-c', 'gatsby build' ]
                                 11 silly lifecycle new-portfolio@1.0.0~build: Returned: code: 1  signal: null
                                 12 info lifecycle new-portfolio@1.0.0~build: Failed to exec build script
                                 13 verbose stack Error: new-portfolio@1.0.0 build: `gatsby build`
                                 13 verbose stack Exit status 1
                                 13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
                                 13 verbose stack     at EventEmitter.emit (events.js:314:20)
                                 13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
                                 13 verbose stack     at ChildProcess.emit (events.js:314:20)
                                 13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
                                 13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
                                 14 verbose pkgid new-portfolio@1.0.0
                                 15 verbose cwd /codebuild/output/src648320162/src/simonshampoo.io
                                 16 verbose Linux 4.14.248-189.473.amzn2.x86_64
                                 17 verbose argv "/root/.nvm/versions/node/v12.21.0/bin/node" "/root/.nvm/versions/node/v12.21.0/bin/npm" "run" "build"
                                 18 verbose node v12.21.0
                                 19 verbose npm  v6.14.11
                                 20 error code ELIFECYCLE
                                 21 error errno 1
                                 22 error new-portfolio@1.0.0 build: `gatsby build`
                                 22 error Exit status 1
                                 23 error Failed at the new-portfolio@1.0.0 build script.
                                 23 error This is probably not a problem with npm. There is likely additional logging output above.
                                 24 verbose exit [ 1, true ]
2021-11-02T07:59:58.513Z [ERROR]: !!! Build failed
2021-11-02T07:59:58.513Z [ERROR]: !!! Non-Zero Exit Code detected
2021-11-02T07:59:58.513Z [INFO]: # Starting environment caching...
2021-11-02T07:59:58.513Z [INFO]: # Environment caching completed
Terminating logging...

It says that my node is outdated, but I do node -v in the project directory and it says I have v14.8.1, so I am confused. Is there another problem? public subdirectory was previously gitignored, so I removed it from there, but that doesn't seem to do anything. I can't find much information about deployment failures on Amplify since it's supposed to be straightforward. Do I have to use nvm? It also won't even deploy on Github pages-- it just shows the "Gatsby Minimal Starter" page in my repo.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I think there's a mismatching Node version between your local environment and the AWS Amplify's. If you run different versions of Node, the installed dependencies in the npm install will be different so your application will behave differently in both environments, assuming that it builds locally (if don't, there might be another underlying problem).

As you pointed, you can use nvm to set the provision version. Based on How to change Node Version in Provision Step in Amplify Console you can try:

frontend:
  phases:
    preBuild:
      commands:
        - nvm install your_local_node_version

Using a .nvmrc file in the root of the project should also work. You can set it directly by:

node -v > .nvmrc

Out of the scope of the question: /public directory should be always ignored because it's autogenerated in each build, so it will be overridden. There's no point in pushing it and it will save you MB bandwidth.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda