Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '../native' (when using V3 spec beta release) #514

Closed
TimothyJones opened this issue Oct 6, 2020 · 9 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@TimothyJones
Copy link
Contributor

Copied from another issue about V3:


I'm having similar issue with 10.x as well. But we are not using jest-pact and the error is

    Cannot find module '../native' from 'node_modules/@pact-foundation/pact/v3/index.js'

Originally posted by @aelmekeev in #483 (comment)

@TimothyJones
Copy link
Contributor Author

TimothyJones commented Oct 6, 2020

@mefellows @uglyog : I encountered this too, and fixed it by modifying the import to ../native/index.node. I don't have the context for the V3 branch though - would that be an appropriate fix? If not, how should we resolve this?

@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior ready labels Oct 6, 2020
@mefellows
Copy link
Member

It may do. My recollection of the issue is that if pact is installed at a different level (e.g. within another dependency or lerna hierarchy) the relative path isn't resolved correctly.

We'll need to reliably reproduce it to fix first.

@TimothyJones
Copy link
Contributor Author

TimothyJones commented Oct 7, 2020 via email

uglyog pushed a commit that referenced this issue Oct 8, 2020
@uglyog
Copy link
Member

uglyog commented Oct 8, 2020

I've updated the imports, but I haven't been able to replicate this issue. It was worked ok for my test projects.

@uglyog
Copy link
Member

uglyog commented Oct 8, 2020

Ah! from 'node_modules/@pact-foundation/pact/v3/index.js'
should have been from 'node_modules/@pact-foundation/pact/v3/pact.js'

due to the types and main entry in package.json. This has now been changed to index instead of pact

@aelmekeev
Copy link

My recollection of the issue is that if pact is installed at a different level (e.g. within another dependency or lerna hierarchy) the relative path isn't resolved correctly.

This is probably the case cause we are using yarn workspaceses and @pact-foundation is in root level node_modules and not "workspace" level node_modules.

@TimothyJones
Copy link
Contributor Author

@aelmekeev Does v10.0.0-beta.17 work for you?

@aelmekeev
Copy link

@TimothyJones it does work 🎉

@TimothyJones
Copy link
Contributor Author

Great! It works for jest-pact's beta V3 build too, so I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants