Skip to content

[Bug]: Yarn refuses to build package that is inside of node_modules, saying it needs a yarn.lock file #5804

@trusktr

Description

@trusktr

Self-service

  • I'd be willing to implement a fix

Describe the bug

The lume project I've been trying to migrate to Yarn for workspace management depends on deasync. When I yarn install, I get this output:

➤ YN0009: │ deasync@npm:0.1.28 couldn't be built successfully (exit code 1, logs can be found here: C:\Users\trusktr\AppData\Local\Temp\xfs-8901406d\build.log)

and I see this in build.log:

# This file contains the result of Yarn building a package (deasync@npm:0.1.28)
# Script name: install

�[31m�[1mUsage Error�[22m�[39m: The nearest package directory (D:\src\lume+lume\packages\docsifyjs+docsify\node_modules\deasync) doesn't seem to be part of the project declared in D:\src\lume+lume.

- If D:\src\lume+lume isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If D:\src\lume+lume is intended to be a project, it might be that you forgot to list packages/docsifyjs+docsify/node_modules/deasync in its workspace configuration.
- Finally, if D:\src\lume+lume is fine and you intend packages/docsifyjs+docsify/node_modules/deasync to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

�[1m$ �[22myarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Build failed

None of those three options seem to be applicable:

  • lume is intended to be a project, so leaving yarn.lock and package.json
  • lume is a project, but listing a dependency in node_modules that doesn't exist before I run yarn install as project doesn't seem correct
  • lume is fine, but modifying dependencies inside of node_modules doesn't seem correct either, especially because it would require a post-install patch or to commit node_modules into the repo

To reproduce

The lume repo at this commit should show the error, just yarn install:

https://github.com/lume/lume/tree/5bd0cac03077ffa98ee90d72de2ad7b902907db6

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 20.5.0 - ~\AppData\Local\Temp\xfs-c4ef94ef\node.CMD
    Yarn: 3.6.4 - ~\AppData\Local\Temp\xfs-c4ef94ef\yarn.CMD
    npm: 9.8.0 - D:\Program Files (x86)\nodejs\npm.CMD

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that didn't get attentionwaiting for feedbackWill autoclose in a while unless more data are provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions