Hi there I'm trying to build and deploy my react app using bitbucket pipelines, I have built and deploy other ones, but for some reason this one is throwing me the following error
----------------------Building the project 👷🏽♂️
----------------------
yarn run v1.22.5
$ env-cmd -f .env.development react-scripts build
Creating an optimized production build...
Failed to compile.
TypeError: (intermediate value)(intermediate value)(intermediate value).slice(...).reverse(...).flatMap is not a function
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Connection to $SERVER_ADRESS closed.
✖ Execution failed.
I can build the project locally, and I can actually manually deploy it as well when I connect to the server and run `yarn run build:develop`, but for some reason it breaks on the pipeline.
Here is my `bitbutcket-pipeline.yml` for reference.
image: node:15.2.1
pipelines:
branches:
"{master,main}":
- step:
name: Deploying development 🚀
caches:
- nodeall
- yarn
script:
- echo 'Connecting to remote server to update repo'
- node --version
- npm --version
- pipe: atlassian/ssh-run:0.2.2
variables:
SSH_USER: $USER
SERVER: $SERVER_ADRESS
COMMAND: "cd smiling-scripts && bash admin-deploy-dev.sh"
definitions:
caches:
nodeall: ./node_modules
yarn: /usr/local/share/.cache/yarn
EDIT: 23.08.2022
Hi @Theodora Boudale
thanks for the reply. Yes that's the error I get from the command pipe: atlassian/ssh-run:0.2.2 (and - pipe: atlassian/ssh-run:0.4.1) now that I have changed it.
I don't get any errors when I connect to my server and build it manually. It builds without errors. Same as when I do it locally.
I can't understand why is only braking on the pipeline script. I have deleted the `node_modules` and reinstalled everything on the server but now I get the following error on the pipeline (so at least is not the same one 🙃, but still unable to build)
yarn run v1.22.5 $ env-cmd -f .env.develop react-scripts build /home/$USER/$USER-admin-develop/node_modules/eslint-webpack-plugin/node_modules/jest-worker/build/index.js:110 _ending; ^ SyntaxError: Unexpected token ; at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Hi @DS,
I would also suggest updating the version of the pipe to the newest one (0.4.1)
- pipe: atlassian/ssh-run:0.4.1
as you're using a version that is quite older.
Kind regards,
Theodora
Hi @Theodora Boudale I updated my question. I tried to 'reply' to your message, but for some reason bitbucket keeps telling me 'You have posted a similar answer in the last few days please review your answer or change the text'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @DS,
Thank you for the update. You mentioned that you don't get any errors when you connect to your server and build it manually.
Are you running the script admin-deploy-dev.sh located in smiling-scripts directory in order to build when you connect to your server?
It's not very clear from your reply if you run the same script on your server, or if e.g. you are running build commands directly without executing this specific script. Earlier in your post you mentioned that you ran `yarn run build:develop` on your server instead of executing the script.
Could you please let me know if the build is successful when you execute the script admin-deploy-dev.sh on the server? Just to check if the error seems to be specific to the script or not.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So both things actually work in the server:
- if I run the build via the `admin-deploy-dev.sh` script -> the application builds
- if I run the build via `yarn run build:develop` -> the application also builds.
What I found out after trying and debugging more is that when I downgrade the `react-scripts` pkg to `@v4.0.1`, the application will build normally, however some styles and other stuff will not be available in the final product (this of course is not desirable)
Right now I'm `react-scripts @V.5.01` when I leave as it is, it is when I get the following error:
/home/$USER/$USER-admin-develop/node_modules/eslint-webpack-plugin/node_modules/jest-worker/build/index.js:110 _ending; ^ SyntaxError: Unexpected token ; at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dante Solis,
Thank you for the info.
Could you please try one more thing, run the pipe with MODE: 'script' and COMMAND: './smiling-scripts/admin-deploy-dev.sh' and let me know if this works or if you still get errors (and if so, what errors)?
- pipe: atlassian/ssh-run:0.4.1
variables:
SSH_USER: $USER
SERVER: $SERVER_ADRESS
MODE: 'script'
COMMAND: './smiling-scripts/admin-deploy-dev.sh'
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Theodora Boudale sorry that it has taken me sol long to reply. I got busy with another project and work.
At the end we gave up and then the project was taken from us.
Thanks in any case for your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dante Solis,
Thanks for the update. If you ever work on this again and need assistance, or if you need help with anything else, please feel free to reach out.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.