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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

node_modules packages not mentioned in the bitbucket pipeline Edited

Hey guys,

i wanted to start with bitbucket pipelines. I had a small wordpress project where i use the dependecies laravel-mix, cross-env, webpack and tailwindcss to build my assets files.

i create the bitbucket-pipelines.yml

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.


image: node:13.2.0

pipelines:
default:
- step:
name: Install node
caches:
- node
script:
- rm -rf node_modules && rm package-lock.json
- npm install --global cross-env
- npm install
- ls -la nod_modules # cross-env was listed

- step: name: Install packages
script:
- npm run pipeline:check
- npm run dev

 

here are my package.json

"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",

 

when i run the pipeline build i always get an error that the dependecies was not found.

i try to change the path from

 cross-env

to

 ./node_modules/cross-env/dist/bin/cross-env/cross-env.js

because the file is on this path located but i get also an error.

 

i try to print my node_modules folder in the pipleine and the cross-env exists. i also had the same node version used. my node_modules folder was added in the .gitignore file.

how can i run the npm commands that bitbucket pipeline find my node_module packages?

1 answer

0 votes
Graham Gatus Atlassian Team Dec 19, 2019

Hi @Penny , each step consists of a clone of your repository, and a docker container (in your case, a node:13.2.0 container, however state is not passed between steps. In this scenario, you should run your npm "dev" script in the first step, or re-install required dependencies in the second step.

If you need to pass state between steps, you can consider using artifacts, however best practice would be to install any tools you need in the step where they are used.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,225 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you