Hi there I'm trying to build and deploy a `nextjs` but my pipeline brakes when building the project.
I'm beginning to believe that there's something wrong with the docker images inside the pipelines or something that I'm not understanding. I had the same problem with a previous project in react , pipeline build process failed with an error message about `node_modules`
The pipeline fails with this error:
<span>$ env-cmd -f .env.development next build</span>
<span>/home/$USER/$USER-frontendv2/node_modules/next/dist/telemetry/storage.js:101</span>
<span> notify = ()=>{</span>
<span> ^</span>
<span>SyntaxError: Unexpected token =</span>
<span> at Module._compile (internal/modules/cjs/loader.js:723:23)</span>
<span> at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)</span>
<span> at Module.load (internal/modules/cjs/loader.js:653:32)</span>
<span> at tryModuleLoad (internal/modules/cjs/loader.js:593:12)</span>
<span> at Function.Module._load (internal/modules/cjs/loader.js:585:3)</span>
<span> at Module.require (internal/modules/cjs/loader.js:692:17)</span>
<span> at require (internal/modules/cjs/helpers.js:25:18)</span>
<span> at Object.<anonymous> (/home/$USER/$USER-frontendv2/node_modules/next/dist/build/index.js:37:16)</span>
<span> at Module._compile (internal/modules/cjs/loader.js:778:30)</span>
<span> at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)</span>
This is my `pipeline.yml`
<span>$ yarn run build:development && pm2 restart $USER-frontendv2-develop</span>
image: node:18.12.0
pipelines:
branches:
main:
- step:
name: Running Lint and Prettier.
script:
- yarn install
- yarn run lint
- yarn prettier
- step:
name: Deploying development 🚀
caches:
- nodeall
- yarn
script:
- echo 'Connecting to remote server to update repo'
- node --version
- yarn --version
- nvm --version
- pipe: atlassian/ssh-run:0.4.1
variables:
SSH_USER: $USER
SERVER: $SERVER_ADRESS
COMMAND: " cd smiling-scripts && bash frontendv2-deploy-development.sh"
# MODE: "script"
# COMMAND: "../smiling-scripts/frontendv2-deploy-development.sh"
definitions:
caches:
nodeall: ./node_modules
yarn: /usr/local/share/.cache/yarn