Npm Install From Bitbucket

Configure your.ssh/config file in order for npm to use the right key: see 'Is there a way to specify which ssh key should be used for npm install' share| improve this answer answered Oct 21 at 17:47. Branch Management with Bitbucket. As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team.

  1. Npm Install From Bitbucket
  2. Npm Install From Bitbucket Download
  3. Npm Install From Cache
  4. Npm Install From Private Bitbucket
Active1 year, 2 months ago

Question

What is wrong with my Dockerfile or bitbucket-pipelines.yml? Why are modules missing from the bitbucket pipelines environment?

Error

When I try to npm run build my Vue2 project with webpack using Bitbucket Pipelines, I get errors regarding missing modules.

From Logs

Files

Here are the files for configuration.

Dockerfile - builds cportwine/people-is

bitbucket-pipelines.yml

package.json

What I see

When I ls the node_modules folder in both environments, they do not match. Modules are missing from bitbucket pipelines.

local folder

people-is/node_modules

bitbucket folder

Npm install git repository

/opt/atlassian/pipelines/agent/build/node_modules

Woah, missing modules!

What I have tried

I added a command to the bitbucket-pipelines.yml to npm install before I build.

bitbucket-pipelines.yml

This adds some additional modules (like cli-spinners from the error) to /opt/atlassian/pipelines/agent/build/node_modules.

bitbucket folder

/opt/atlassian/pipelines/agent/build/node_modules

However, the build command still fails, due to a different missing module.

Error

Chadd
ChaddChadd

2 Answers

Bitbucket

Solutions

I can now build the app, but I don't know why!

1 - Simplify the Dockerfile

I removed all the npm commands. Maybe the npm install commands were redundant? There was no advantage using the Docker Image to pre-install npm packages.

2 - Remove Node_Modules before install

Using the bitbucket-pipelines.yml, remove the node_modules folder, and then perform npm install -g npm and npm install and npm install -g firebase-tools.

File Changes

bitbucket-pipelines.yml (added lines)

Dockerfile (lines removed)

Answer ?

I'm not sure why moving all the npm install stuff into the bitbucket.pipelines.yml solved my issue building the project. I thought Docker would enable me to define my environment, e.g., install a version of node/npm and firebase. And pipelines would 'run' that.

If someone could explain what I am missing, I would accept that answer.

ChaddChadd

Answer

I received support from the Atlassian Team

  1. Leave npm install -g firebase in the docker image.
  2. Move npm install from the docker image to thebitbucket-pipelines.yml file.

Reason

The node_modules folder was listed in .gitignore

Npm Install From Bitbucket

tl;dr

My mistake - I forgot about .gitignore and how that affects the node_modules folder in source control, e.g., Bitbucket Pipelines.

I was looking at my localnode_modules folder and building locally which worked.

However

The node_modules in source control, by design, is not in-sync with my local folder because it's included in the .gitignore file.

So

It was necessary for me to rm node_modules and npm install using the bitbucket-pipelines.yml. Now, BitPipes finds the modules I have installed locally.

This is sort of the point of maintaining the package.json, but I got confused.

ChaddChadd

Not the answer you're looking for? Browse other questions tagged node.jsdockernpmpackage.jsonbitbucket-pipelines or ask your own question.

Npm Install From Bitbucket Download

Active1 year, 2 months ago

Question

What is wrong with my Dockerfile or bitbucket-pipelines.yml? Why are modules missing from the bitbucket pipelines environment?

Error

When I try to npm run build my Vue2 project with webpack using Bitbucket Pipelines, I get errors regarding missing modules.

From Logs

Files

Here are the files for configuration.

Dockerfile - builds cportwine/people-is

bitbucket-pipelines.yml

package.json

What I see

When I ls the node_modules folder in both environments, they do not match. Modules are missing from bitbucket pipelines.

local folder

people-is/node_modules

bitbucket folder

/opt/atlassian/pipelines/agent/build/node_modules

Woah, missing modules!

What I have tried

Npm Install From Cache

I added a command to the bitbucket-pipelines.yml to npm install before I build.

bitbucket-pipelines.yml

This adds some additional modules (like cli-spinners from the error) to /opt/atlassian/pipelines/agent/build/node_modules.

bitbucket folder

/opt/atlassian/pipelines/agent/build/node_modules

However, the build command still fails, due to a different missing module.

Error

Chadd
ChaddChadd

2 Answers

Solutions

I can now build the app, but I don't know why!

1 - Simplify the Dockerfile

I removed all the npm commands. Maybe the npm install commands were redundant? There was no advantage using the Docker Image to pre-install npm packages.

2 - Remove Node_Modules before install

Using the bitbucket-pipelines.yml, remove the node_modules folder, and then perform npm install -g npm and npm install and npm install -g firebase-tools.

File Changes

bitbucket-pipelines.yml (added lines)

Dockerfile (lines removed)

Answer ?

I'm not sure why moving all the npm install stuff into the bitbucket.pipelines.yml solved my issue building the project. I thought Docker would enable me to define my environment, e.g., install a version of node/npm and firebase. And pipelines would 'run' that.

If someone could explain what I am missing, I would accept that answer.

ChaddChadd

Answer

I received support from the Atlassian Team

  1. Leave npm install -g firebase in the docker image.
  2. Move npm install from the docker image to thebitbucket-pipelines.yml file.

Reason

The node_modules folder was listed in .gitignore

tl;dr

My mistake - I forgot about .gitignore and how that affects the node_modules folder in source control, e.g., Bitbucket Pipelines.

I was looking at my localnode_modules folder and building locally which worked.

However

The node_modules in source control, by design, is not in-sync with my local folder because it's included in the .gitignore file.

So

It was necessary for me to rm node_modules and npm install using the bitbucket-pipelines.yml. Now, BitPipes finds the modules I have installed locally.

This is sort of the point of maintaining the package.json, but I got confused.

ChaddChadd

Npm Install From Private Bitbucket

Not the answer you're looking for? Browse other questions tagged node.jsdockernpmpackage.jsonbitbucket-pipelines or ask your own question.

Comments are closed.