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 'source-map' from 'source-map-support.js' #265

Open
examineyou65 opened this issue Jan 3, 2020 · 4 comments
Open

Cannot find module 'source-map' from 'source-map-support.js' #265

examineyou65 opened this issue Jan 3, 2020 · 4 comments

Comments

@examineyou65
Copy link

examineyou65 commented Jan 3, 2020

I am created react project by using npx create-react-app. I have installed jest package for unit test. when I was run unit test, this Cannot find module 'source-map' from 'source-map-support.js' error occur. I couldn't find any solution. Please do the needful.

I have tried reinstall source map support module but no use on that.

@cmf-joo
Copy link

cmf-joo commented Jan 6, 2020

Exact same problem. I created a minimal project to try to troubleshoot the problem, basically with sum.js and sum.test.js. When I run the test, it fails with the below message:

 FAIL  ./sum.test.js
  ● Test suite failed to run

    Cannot find module 'source-map' from 'source-map-support.js'

      at Resolver.resolveModule (H:/WORKSPACE/tmp/testProj/node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (node_modules/source-map-support/source-map-support.js:1:114)

My versions:
npm@6.13.4
node@v12.14.0
Windows10

@examineyou65
Copy link
Author

@cmf-joo This problem was not related to source map support. did you run your project any Network or Ram Disk Path like virtual computer?
If yes then change your jest config modulepath.

@cmf-joo
Copy link

cmf-joo commented Jan 15, 2020

My project is set up on a local folder on a local machine. Were you able to find a solution?

@andinoJamesV
Copy link

andinoJamesV commented May 30, 2020

This appears to be 1/2 a NYC issue istanbuljs/nyc#1323

Exploring further I can see that there is a logic error in nyc for the include flag

https://github.com/istanbuljs/nyc/blob/992359a1e2108906e28324058008f28aa1052dc1/index.js#L133

./node_modules/.bin/nyc --require source-map-support/register.js --source-map=false  ./node_modules/mocha/bin/mocha o/Test/Spork.js

will load the source maps library but line numbers are still incorrect.
I guess that's what the cute @ symbols are all about

Probably because the source map library hooks require improperly in NYC?

Meanwhile looking at NYC and its instrument code the source map flags seem completely super broken ( there is no particular logic to toggling them on and off and making a Boolean chart of the results ) and I can not imagine where to look to figure out why simply including source mapping options on results in failing to cover anything as the instrument files look ~ the same just including or not including source map comments.

( Unless as I type this I am thinking requiring the library to handle source maps is breaking NYCs require hook )

I think the issue is non standard hooking of require but Im not sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants