Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,361
Community Members
 
Community Events
184
Community Groups

Bitbucket pipeline fails with '<package> not found' error

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"

 

1 answer

1 accepted

0 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Aug 17, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events