score:0
i discovered a new situation,another possibility is an error during installation, reinstall ts-node
to fix the problem
score:1
fyi this just happened to me at work. i'm not enough of an expert to understand what's going on under the hood, but the root of my problem was that i had my project running inside webpack in dev mode in a primary terminal, at the same time i was trying to run the tests in a 2nd terminal.
once i stopped the dev server, the tests ran just fine afterwards.
score:1
make sure to have:
moduledirectories: ["node_modules"]
not:
moduledirectories: ["/node_modules/"]
and don't omit the node_modules here.
score:2
i resolve the problem by running the project and node in the same drive.
i.e. previously my code is put in q:/
drive, and my nodejs is install in c:/
drive.
and it keeps saying cannot find module 'source-map' from 'source-map-support.js'
when i run jest.
once after i open my project in c:/
, then it works.
score:5
hit this issue when using a jest test runner in vs code.
taking a pointer from https://github.com/facebook/jest/issues/6880#issuecomment-441499110, i noticed that my jest.config.js
contained
moduledirectories: ["<rootdir>/node_modules", "<rootdir>/clientapp"]
changing it to
moduledirectories: ["node_modules", "clientapp"]
fixed the problem.
Source: stackoverflow.com
Related Query
- Cannot find module 'ReactNative' from 'react-native.js' w/ Jest
- Jest - Cannot find module 'source-map' from 'source-map-support.js'
- Jest fails Cannot find module 'react/lib/React' from 'ReactShallowRenderer.js' after React 16 upgrade
- react storybook jest snapshots leads to an error Cannot find module '../../package' from 'node.js'
- Jest cannot find module from file in the same folder
- Cannot find module 'react-dom/client' from 'node_modules/@testing-library/react/dist/pure.js'
- Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js'
- Cannot find module '@babel/plugin-transform-runtime' from
- Jest fails with error: Cannot find module 'react/lib/ReactComponentTreeHook'
- React & Jest: Cannot find module from test file
- Cannot find module 'react' from 'pure.js'?
- Cannot find module '../request' error using mock in Jest
- Cannot find module 'enzyme' from 'setupTests.ts'
- Jest Cannot find SCSS module
- Setting up Jest and Enzyme to test React 15 cannot find module react/lib/ReactTestUtils
- Jest cannot find module @env React Native
- Cannot find module 'react' from 'Provider.js'
- Cannot find module issue with imports-loader when testing with Jest
- Jest is unable to find module from test file
- Browserify: Cannot find module '...' from '...' (Coffeescript + React)
- Cannot find module 'react-dom/test-utils' from 'act-compat.js'
- Browser Console error: Cannot find module 'react-dom/lib/ReactPerf' from 'react/lib/ReactAddonsDOMDependencies.js'
- Jest Cannot Find Module react-location
- Trying to use jest with create-react-app and typescript. Get error: Jest: Failed to parse the TypeScript config file... Cannot find module 'ts-node'
- Cannot find module 'enzyme' from 'src/setupTests.js'
- Jest React - Test suite failed to run, Cannot find module 'react-dotenv'
- React jest Cannot find module '@island.is/core'
- Cannot find module error while import using jest in next.js
- Cannot find module 'react' from '/react/node_modules/react-redux/lib/components'
- Jest cannot find module 'config'
More Query from same tag
- React setState object key with conditional event target
- React Js - reaching inner functions with outer variables
- ReactJS and images in public folder
- How to implement Broadcast Channel API in React
- React useState and onSubmit form doesn't update the state immediately - validation best practice
- Prevent router from inserting slashes after hashes
- How do I Bind the function instead of creating a new one?
- Why doesn't comparing arrays in componentDidUpdate lead to infinite loop?
- Connecting my React App to a MySQL Database on a PHP Server
- React get form field value in onSubmit
- How to make svg RTL
- Why is my React app returning an #152 error when using fetch?
- Can't beat the "Actions must be plain objects. Use custom middleware for async actions." error while trying to follow redux.js.org tutorial
- How to define the correct interface and loop over the data in React?
- Express: serve Webpack bundle on subroutes
- How to map an array of object
- Selective static html export of pages in NextJS
- how to use reduce function to get the total number of GitHub repository of a user
- How to clean up a Redux "useDispatch" action inside useEffect?
- How to fix redux-observable Parameter 'action$' implicitly has an 'any' type
- How to display my react application as desktop view on mobile?
- React - Component not updating after props change
- TypeError: undefined is not an object - reactjs
- Conflict between styled-components and Webpack 5 Federated Modules (Invalid hook call)
- Perform a GET Request in React.js
- I receive error 404 on refreshing browser using React router in Laravel Mix
- React Complex Form Editing key value pair
- How to extend css modules in next js?
- Inserting image tag inside a template literal
- callback in nested state object