berry: [Bug] Can't install dependencies in a project containing `node-sass`
- I’d be willing to implement a fix
Describe the bug
Can’t install dependencies in a repo that contains a package that includes node-sass
the install fails with the following error:
➤ YN0013: │ react-tether@https://github.com/marvelapp/react-tether.git#commit:b076c38b5c6bf752076109ab0d85876f80133f7b can't be found in the cache and will be fetched from the remote repository
➤ YN0032: │ nan@npm:2.13.2: Implicit dependencies on node-gyp are discouraged
➤ YN0058: │ react-tether@https://github.com/marvelapp/react-tether.git#commit:b076c38b5c6bf752076109ab0d85876f80133f7b: Installing the package dependencies failed (exit code 1, logs can be found here: /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-26497T4RvdJK0MxFf.log)
➤ YN0000: └ Completed in 20.94m
➤ YN0000: Failed with errors in 20.94m
When I view /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-26497T4RvdJK0MxFf.log
I get:
➤ YN0000: ┌ Resolution step
➤ YN0013: │ tether@https://github.com/rdjpalmer/tether.git#commit:d28f5ee85 can't be found in the cache and will be fetched from the remote repository
➤ YN0058: │ tether@https://github.com/rdjpalmer/tether.git#commit:d28f5ee85: Installing the package dependencies failed (exit code 1, logs can be found here: /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-31518KpPr3LQ16Nvq.log)
➤ YN0000: └ Completed in 11.48m
➤ YN0000: Failed with errors in 11.48m
When I view /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-31518KpPr3LQ16Nvq.log
I get:
➤ YN0000: ┌ Resolution step
➤ YN0032: │ nan@npm:2.14.0: Implicit dependencies on node-gyp are discouraged
➤ YN0000: └ Completed in 4.42m
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1.04s
➤ YN0000: ┌ Link step
➤ YN0007: │ node-sass@npm:3.13.1 must be built because it never did before or the last one failed
➤ YN0009: │ node-sass@npm:3.13.1 couldn't be built successfully (exit code 1, logs can be found here: /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-33861492KRMzRXRVE.log)
➤ YN0000: └ Completed in 1.32m
➤ YN0000: Failed with errors in 5.76m
When I view /var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/logfile-33861492KRMzRXRVE.log
I get:
gyp ERR! stack at ChildProcess.onExit (/private/var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/tmp-31518hOrRJdtgp2w7/.yarn/unplugged/node-gyp-npm-3.8.0-34b3928909/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/george/.nvm/versions/node/v12.4.0/bin/node" "/private/var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/tmp-31518hOrRJdtgp2w7/.yarn/unplugged/node-gyp-npm-3.8.0-34b3928909/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /private/var/folders/ys/h7v748cd01n0_q_1_0v852g40000gn/T/tmp-31518hOrRJdtgp2w7/.yarn/unplugged/node-sass-npm-3.13.1-6249db71d7/node_modules/node-sass
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
To Reproduce
await expect((async () => {
await packageJsonAndInstall({
dependencies: {'react-tether': 'https://github.com/marvelapp/react-tether.git#b076c38b5c6bf752076109ab0d85876f80133f7b'},
});
})()).rejects.toThrow('Installing the package dependencies **failed**');
Screenshots
Environment if relevant (please complete the following information):
- OS: macOS Mojave 10.14.6
- Node version: v12.4.0
- Yarn version: 2.0.0-rc.12
Additional context
I have attempted to yarn unplug node-sass
and the module that imports it too.
This installed OK on yarn version 1.19.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 23 (6 by maintainers)
The
dependenciesMeta
settings have no effect in your context because your application doesn’t depend onnode-sass
-tether
does. It’s a bit contrived but basically when you have a git dependency we need to clone it inside a temporary directory, install its dependencies, and runyarn pack
(in case it has aprepack
script which would generate build artifacts etc). Only then is the resulting tarball imported into your app.This is what happens:
tether
is cloned, so we install its dependencies (including dev dependencies), independently from the ones in your own app. And since the crash happens while the git tarball is being generated, Yarn didn’t get the chance to know what are the package’ dependencies - preventing the resolution to be complete, and thus the lockfile to be written.I think it might not have been the case in the v1 because we didn’t run
prepack
(orprepare
) on git dependencies … https://github.com/yarnpkg/yarn/issues/5235