question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug?]: unexpected to evaluate the devDependencies of a dependence package from git source even when there is no build script in it.

See original GitHub issue

Self-service

  • I’d be willing to implement a fix

Describe the bug

When:

  • use yarn command to install a dependence package from Git Source;
  • there are no build scripts in the git package;
  • there is a dev dependence package whose descriptor is "workspace:*", and it’s not hosted in the repository of the git package.

what happens:

  • yarn failed with YN0058.
 YN0058: │ git-source-package@git+ssh://git@github.com:AmyFoxFN/yarn-demo-git-source-package.git#commit=b367f12603cbc45eb3db49d44d6363e928f6b6d5: Packing the package failed (exit code 1, logs can be found here: /private/var/folders/vk/jl551z8j4157nvxvv9wj1sqr0000gn/T/xfs-a1cb5754/pack.log)
  • errors in pack.log.
ct [Error]: local-workspace@workspace:*: No local workspace found for this range
    at xVe (/Users/didi/.node/corepack/yarn/3.2.0/yarn.js:712:37482)
    at Xa.triggerHook (/Users/didi/.node/corepack/yarn/3.2.0/yarn.js:396:3373)
    at Yue (/Users/didi/.node/corepack/yarn/3.2.0/yarn.js:712:30939)
    at /Users/didi/.node/corepack/yarn/3.2.0/yarn.js:712:30487 {
  reportExtra: undefined,
  reportCode: 21
}

To reproduce

await expect(packageJsonAndInstall({
  dependencies: {
    [`git-source-package`]: `git+ssh://git@github.com:AmyFoxFN/yarn-demo-git-source-package.git#b367f12603cbc45eb3db49d44d6363e928f6b6d5`,
  }
})).resolves.toBeTruthy()

It seems the default sherlock reproduction env could not install packages by git+ssh. You may need to use my own demo to reproduce:

Environment

System:
    OS: macOS 12.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.17.0 - /private/var/folders/vk/jl551z8j4157nvxvv9wj1sqr0000gn/T/xfs-75b5a995/node
    Yarn: 3.3.0 - /private/var/folders/vk/jl551z8j4157nvxvv9wj1sqr0000gn/T/xfs-75b5a995/yarn
    npm: 8.15.0 - /usr/local/bin/npm

Additional context

Related issue #1915

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
fkworldcommented, Nov 24, 2022

I also encountered this problem in my recent work.

My troubleshooting results are as follows:

  1. yarn executes the yarn pack once when installing packages for the git protocol.
  2. yarn pack executes the beforeWorkspacePacking hook.
  3. In this hook, three kinds of dependencies: dependencies, devDependencies, peerDependencies are handled.
  4. There is a dependencies package written in workspace: * way, the corresponding dependency is not found, and an error is reported: No local workspace found for this range.
  5. pack fails and pops up, yarn install fails.

Code position: https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/index.ts#L59

0reactions
yarnbotcommented, Nov 23, 2022

This issue reproduces on master:

Error: expect(received).resolves.toBeTruthy()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0001: │ git-source-package@git+ssh://git@github.com:AmyFoxFN/yarn-demo-git-source-package.git#b367f12603cbc45eb3db49d44d6363e928f6b6d5: Failed listing refs
➤ YN0001: │   Repository URL: git@github.com:AmyFoxFN/yarn-demo-git-source-package.git
➤ YN0001: │   Ssh -o batchmode=yes Error: line 1: ssh: not found
➤ YN0001: │   Fatal Error: Could not read from remote repository.
➤ YN0001: │   Exit Code: 128
::endgroup::
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 68ms
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-44ff9ab1e7.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:2:7)
    at /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:57:19
    at executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:18:22)
    at executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:25:18)
    at ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:26:76)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] NPM 'installing' devDependencies of my dependency ...
NPM is trying to install the devDependencies from my dependency just because there is a script in package.json named "build". It didn't put...
Read more >
'npm start' returns error: "There might be a problem with the ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >
Package dependencies - Dart
Dependencies are one of the core concepts of the pub package manager. A dependency is another package that your package needs in order...
Read more >
How to troubleshoot NPM problems - JFrog
Enable Dependency Rewrite option for virtual repositories. This allows Artifactory to ; cache GitHub metadata associated with npm packages and ...
Read more >
ts-node - npm
ts-node is a TypeScript execution engine and REPL for Node.js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found