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

Getting yarn 3.1.1 not found. Is there a workaround?

Sergey Shteyn February 15, 2022

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

1 vote
Ankit Gupta February 20, 2022

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

yarn set version 3.1.1
Florian Probst February 20, 2022

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
0 votes
Florian Probst February 18, 2022

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.

0 votes
Ankit Gupta February 15, 2022

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
AUG Leaders

Atlassian Community Events