When I am testing React components using Jest, I get following error for those components using imports-loader.
Cannot find module 'imports-loader?jQuery=jquery!bootstrap/js/tooltip'
Does anyone know how to fix this?
You should install the missing module:
npm install imports-loader
Related
I am following this tutorial for using DynamoDB with React.JS but I get an error that the aws-sdk library can't resolve util.
It is a node package so I shouldn't actually change its code.
I found an answer when using it for Angular here. It also works fine for React.js.
Just install the util package: yarn add util.
The aws-sdk package should have this included in its package file as a dependency.
I have the component react-native-modal-datetime-picker in my React Native project. It's throwing the following error:
error: bundling failed: Error: Unable to resolve module '#react-native-community/datetimepicker' from 'node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.android.js: #react-native-community/datetimepicker could not be found within the project.
It seems that there's a reference in the react-native-modal-datetime-picker module to the #react-native-community/datetimepicker module. I've never run into a scenario before where I had to manually add a dependency of another dependency. Does anyone have any insight on why this is happening?
see the github
you need to run this:
expo install react-native-modal-datetime-picker #react-native-community/datetimepicker
I encountered this same problem and I found that the autolinking wasn't done so I had to run the command
npx react-native link #react-native-community/datetimepicker
‘ #react-native-community/datetimepicker’ is declared as a peer dependency to ‘ react-native-modal-datetime-picker’. Peer dependencies must be installed alongside the original package.
In dependencies, there should be node in case node is not there install npm i node
and try installing date picker again.
I want to use gridstack.js in my react app to manipulate the grid functionality. But after importing gridstack, npm i react-gridstack, i am having the issues which i am not able to resolve. I did the install on new project as well but did not work. Any clues will be appreciated
npm start
Issue:
Failed to compile.
./node_modules/gridstack/dist/gridstack.js
Module not found: Can't resolve 'jquery-ui/data' in '/home/rbatra/Desktop/react-app/dynamicreact/node_modules/gridstack/dist'
I have installed Jest v17.0.3 in my react project.
When I run jest locally it works fine, but on the build server it fails with:
Error: Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js'
Both machines are running node version 6.9.1 and npm version 4.0.2.
use same version of react and react-dom. My problem fixed after using this command
npm install --save react#15.4.0 react-dom#15.4.0
this problem specially occurs on react 15.4.0 above.
Can you check which version of React you are using? Is it the same on both servers? I would try removing node_modules and reinstalling the dependencies. The reason I am suggesting this is that in React v15.4.0 you cannot import private apis and it seems that ReactDebugTools.js is trying to import from react/lib/....
From the blogpost about React v15.4.0 (Link):
However, there is a possibility that you imported private APIs from react/lib/*, or that a package you rely on might use them. We would like to remind you that this was never supported, and that your apps should not rely on internal APIs. The React internals will keep changing as we work to make React better.
Hope this helps!
In the latest versions of react we often see this error as we have loaded 2 versions of react:
To make sure you have just 1 version, run the following in your terminal:
npm ls react-dom
npm ls react
Both the react and react-dom versions need to be same.
If any one of these returns more than 1 version then that's not supported. You have to then correct it in your corresponding package.json
I had the same issue and i removed the node_modules and ran npm install and it fixed the problem.
I'm getting this error with in all my files:
Module not found: Error: Cannot resolve module 'react/lib/ReactMount' in...
I'm using the latest version of react: 15.4.0.
webpack: 1.12.11
Any help?
One quick solution to this will be use npm to install reactjs.
npm install --save react react-dom
Don't use standalone react bundle.
More solutions can be provided if you post your webpack config file.
The problems seems to be located in react-hot-loader library.
As mentioned #gaereon in my react gitub post, apps should not rely on internal APIs. So, react-hot-loader is using ReactMount.
I asked to fix it, for now I will return to latest version of React.
UPDATE
I had the 1x version. I switched to 3x beta version and works fine.