berry: [Bug] cypress fails install with node-modules linker
- I’d be willing to implement a fix
Describe the bug
Running yarn install
in a project depending on cypress
and using nodeLinker: "node-modules"
fails with ➤ YN0009: │ cypress@npm:3.8.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/logfile-394W9pExI466nwo.log)
.
And it also hangs on the first install but that is already reported in https://github.com/yarnpkg/berry/issues/751
Apparently yarn thinks cypress
requires an undeclared dependency minimist
(used in postinstall) though this dependency is declared.
/tmp/logfile-394W9pExI466nwo.log
# This file contains the result of Yarn building a package (cypress@npm:3.8.2)
# Script name: postinstall
/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:23819
throw firstError;
^
Error: Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies
Required package: minimist (via "minimist")
Required by: /home/eps1lon/Development/src/js/dom-accessibility-api/node_modules/cypress/
Require stack:
- /home/eps1lon/Development/src/js/dom-accessibility-api/node_modules/cypress/index.js
at Object.makeError (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:15564:24)
at resolveToUnqualified (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:24420:35)
at resolveRequest (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:24504:27)
at Object.resolveRequest (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:24572:26)
at Function.module_1.Module._resolveFilename (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:23802:34)
at Function.module_1.Module._load (/home/eps1lon/Development/src/js/dom-accessibility-api/.pnp.js:23687:40)
at Module.require (internal/modules/cjs/loader.js:838:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/eps1lon/Development/src/js/dom-accessibility-api/node_modules/cypress/index.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:945:30) {
code: 'MODULE_NOT_FOUND',
pnpCode: 'UNDECLARED_DEPENDENCY',
data: {
request: 'minimist',
issuer: '/home/eps1lon/Development/src/js/dom-accessibility-api/node_modules/cypress/',
dependencyName: 'minimist'
},
requireStack: [
'/home/eps1lon/Development/src/js/dom-accessibility-api/node_modules/cypress/index.js'
]
}
To Reproduce
await yarn(`init`);
await yarn(`add`, `cypress`);
await yarn(`config`, `set`, `nodeLinker`, `node-modules`);
await expect(yarn(`install`)).resolves.toBeTruthy();
Environment if relevant (please complete the following information):
- OS: Ubuntu 18.04.3 LTS
- Node version: v12.11.1
- Yarn version: 2.0.0-rc.27
Additional context
Switching to node_modules because of https://github.com/prettier/prettier-vscode/issues/1221
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
That should do it. Even includes the full log. Very nice.
@eps1lon an
await
was missing, hence the passing yarnbot even though it should have fail. @larixer try runningyarn sherlock 754
in the repo, it should throw the error.Ok the arrange and act part I got. No idea how the assertion should look to be considered “reproducible”.
Either way I don’t have more time. Hope this is sufficient.
Discovered https://next.yarnpkg.com/advanced/sherlock#can-i-develop-my-reproduction-offline. Give me a sec 😃