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,458,233
Community Members
 
Community Events
176
Community Groups

Getting yarn 3.1.1 not found. Is there a workaround?

While using the following image 

image: node:17.4.0
Getting errorr
+ yarn install

node:internal/modules/cjs/loader:936



Error: Cannot find module '/opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs'

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

at Function.Module._load (node:internal/modules/cjs/loader:778:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

at node:internal/main/run_main_module:17:47 {

code: 'MODULE_NOT_FOUND',

requireStack: []

}

Is there a workaround?  

3 answers

You can add the below to your scripts, this should update the version

yarn set version 3.1.1

Sadly it doesn't (if tried it already in different contexts - root-, build- and home-dir ...), always with the same error - i really don't know why it is looking for the latest node berry version, but i'm not a yarn/node expert:

 

+ yarn set version 3.1.1

node:internal/modules/cjs/loader:936

throw err;

^

Error: Cannot find module '/opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs'

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

at Function.Module._load (node:internal/modules/cjs/loader:778:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

at node:internal/main/run_main_module:17:47 {

code: 'MODULE_NOT_FOUND',

requireStack: []

}

Node.js v17.4.0

 

The quick and dirty solution for me was to download yarn manually and put it on the place where node is looking for it until we have a real solution for this issue.

 

- mkdir -p /opt/atlassian/pipelines/agent/build/.yarn/releases

- curl -o /opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs https://repo.yarnpkg.com/3.1.1/packages/yarnpkg-cli/bin/yarn.js

- corepack enable

- yarn set version berry

 

I know it will only work for a limited time, so this is no real solution.


BR,
Florian

Like Ankit Gupta likes this

We have the same problem when trying to migrate from Docker multistage builds to Bitbucket Pipelines.

Same docker image (I've compared the hashes) works locally and in Docker multi-stages builds with the same set of commands, only Bitbucket Pipelines fails.

As per the image details for `node 17.4.0`, it contains yarn `1.22.17` that is the older version (1.x).

https://hub.docker.com/layers/node/library/node/17.4.0/images/sha256-f9b18e024fc10ebc95d53c5d7cd6858779a7e3670ec6d24bebe8f2353fdf37b1?context=explore

For berry, which is the newer version you might need to create your own image replacing the yarn package.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events