Bitbucket pipeline ng build fails [[ERROR] Could not resolve "three"]

Abbas_ Ajmal _AU_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 8, 2025

I am using three.js in angular application.

ng build works fine locally but bitbucket pipeline fails with falling error.

Error Message: -

[ERROR] Could not resolve "three"

 

> ng build
❯ Building...

✔ Building...Application bundle generation failed. [23.340 seconds]✘ [ERROR] Could not resolve "three"

I do have step to run npm install before ng build in the build pipeline steps
Need input to resolve this issue. Thanks

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2025

Hi @Abbas_ Ajmal _AU_ and welcome to the community!

Does the npm install command run in a different step than the ng build command? If so, this may be the reason for the error.

In builds running on Atlassian's infrastructure or with a self-hosted Linux Docker runner, for every step of the build a Docker container starts, the repo is cloned (unless you have disabled cloning), and then the commands of that step's script are executed. When the step finishes, this container gets destroyed.

Anything you install during a step won't be available to other steps, because each step runs in a separate Docker container.

If your build generates artifacts like binaries or reports that you want to make available to next steps, you can use artifacts.

If we're talking about dependencies though, I suggest installing them during the step that needs them. Having two separate steps would be similar to spinning up a virtual machine, installing dependencies, and then destroying this VM, and spinning up a new one to run your build.

Please feel free to let me know how it goes and if you have any questions!

Kind regards,
Theodora

Abbas_ Ajmal _AU_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 12, 2025

Combining that it to single step solved the issue. Thanks

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2025

That's good to hear, thank you for the update.

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events