You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi there, I'm trying to run `eslint` and `test` in my pipeline but they both fail with the following error:
+ yarn run test
yarn run v1.22.15
$ react-scripts test
/bin/sh: 1: react-scripts: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This is my ` bitbucket-pipeline.yml` file with those specific steps (here is not properly indented, but it is in my actual file)
image: node:16.13.0
pipelines:
default:
- step:
name: Installing Dependencies ?️
script:
- "yarn install"
- step:
name: Code Quality Checks ?
script:
- "yarn run lint"
- step:
name: Unit Testing ?
script:
- "yarn run test"
Hey @DS
G'day.
I believe you received the error because the image you use doesn't have react-scripts installed in it; hence the command was not found.
I found an article that explains this issue and workaround better here , which suggests you install the react-scripts as the example below in your YAML:
script:
- npm i react-scripts
- yarn run test
This should fix the issue; if not, I suggest you review and try the other suggested workaround on the page here.
Cheers,
Syahrul
I don't suggest using both npm and yarn at the same time. It should be one or the other, not both, wherever possible.
I suggest that the issue is that bitbucket pipeline steps do not share their files. Each step runs in a separate container.
So assuming you already have the correct dependencies in package.json, the error is splitting the steps up when the files from "install dependencies" are needed in the "test" step.
I would expect a pipeline like this:
image: node:16.13.0
pipelines:
default:
- step:
name: Code Quality Checks ?
script:
- "yarn run lint"
- step:
name: Unit Testing ?
script:
- "yarn install"
- "yarn run test"
It's possible to share artifacts from one step to another, but in my experience it is simply faster to install the node_modules folder as needed in each step.
https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-pipeline-reuse-source-code-from-previous-step/qaq-p/1711660
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.