Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]The yarn set version from source breaks with Usage Error: Couldn't find the node_modules state file when the YARN_NODE_LINKER=node-modules is set #2955

Closed
1 task
LouisSung opened this issue May 29, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@LouisSung
Copy link

  • I'd be willing to implement a fix

Describe the bug
The yarn set version from source (commit fe19f60)breaks when the node linker is set as node_modules via environment variable YARN_NODE_LINKER=node-modules

To Reproduce
This can be reproduced by the following Dockerfile

FROM node:12.22.1-buster-slim

ENV YARN_NODE_LINKER=node-modules
RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates git \
    \
    && mkdir -p /yarntest && cd /yarntest \
    && yarn set version berry && yarn set version from sources

And the error log was

Running hooks in /etc/ca-certificates/update.d...
done.
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into /yarnSetVersionFailed/.yarn/releases/yarn-berry.cjs...
Updating /yarnSetVersionFailed/.yarnrc.yml...
Done!
➤ YN0000: Cloning the remote repository

  $ git init /tmp/yarnpkg-sources/d0a670
  $ git remote add origin https://github.com/yarnpkg/berry.git
  $ git fetch origin master
  $ git reset --hard FETCH_HEAD

➤ YN0000: Building a fresh bundle

Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)

$ yarn run [--inspect] [--inspect-brk] <scriptName> ...
➤ YN0001: Error: Child "yarn" exited with exit code 1
    at ChildProcess.<anonymous> (/yarnSetVersionFailed/.yarn/releases/yarn-berry.cjs:2:404999)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
➤ YN0000: Failed with errors in 4m 34s
The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends         ca-certificates git         && mkdir -p /yarnSetVersionFailed && cd /yarnSetVersionFailed     && yarn set version berry && yarn set version from sources' returned a non-zero code: 1
@merceyz
Copy link
Member

merceyz commented Jun 10, 2021

This is expected since the command doesn't run yarn install because this repo is configured for Zero-Installs and PnP

@merceyz merceyz closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants