Error when running from pnpm installation
See original GitHub issuecypress-cucumber-preprocessor includes templates which generates application code that imports gherkin, e.g.
const createCucumber = (spec, toRequire) =>
`
...
const {Parser, Compiler} = require('gherkin');
...
`;
Normally, this is not a problem when using popular package managers like npm / yarn because ‘gherkin’ is a direct dependency of cypress-cucumber-preprocessor, which is hoisted to the root node_modules folder, enabling it to be found by webpack / node:
node_modules/
gherkin/
...
cypress-cucumber-preprocessor
But when using strict package managers such as pnpm (or yarn pnp), gherkin cannot be resolved because it can only be resolved by code inside the cypress-cucumber-preprocessor package:
node_modules/
cypress-cucumber-preprocessor
...
node_modules/
gherkin/
...
Solution:
- Add gherkin to peerDependencies so users must install it themselves.
- Also add gherkin to devDependencies so it can run its own tests
similar issues:
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
error when trying to install pnpm when Node.js is not ... - GitHub
Tip: My username in Windows is 'Matheus Corocher'. I think the problem can be that my username has blank space and therefore gives...
Read more >How to warn or error when using "npm install" - Stack Overflow
These generally work either via a preinstall script or by (ab)using the "engines" property in package.json. The node.js project is working on a ......
Read more >nodenv + pnpm "Error running pnpm install..." : WEB-51042
Error running 'pnpm install in vue-dynamic-test' Specify a correct path to an npm or yarn package: no such directory "/Users/tomshaw/. nodenv/shims/pnpm" ...
Read more >Build Error at npx pnpm@7.0.0 install step - Dremio Community
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:npx (pnpm install) on project dremio-ui-lib: Failed to run ...
Read more >pnpm/pnpm - Gitter
Is there a command to run pnpm install for the closest package.json file to my ... (packages/api-extractor-config) ERROR· Command failed with exit code...
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 FreeTop 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
Top GitHub Comments
This was fixed in #191:
https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/pull/191/files#diff-7c7d4918b118d27d18538f53b8155e88L19
The
require('gherkin')
expression no longer exists in the template, so this dependency hoisting problem is gone.@lgandecki That’s fine. 👍