[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 issueSelf-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:
- Created 10 months ago
- Comments:11
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also encountered this problem in my recent work.
My troubleshooting results are as follows:
beforeWorkspacePacking
hook.dependencies
,devDependencies
,peerDependencies
are handled.workspace: *
way, the corresponding dependency is not found, and an error is reported: No local workspace found for this range.Code position: https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/index.ts#L59
This issue reproduces on master: