When I try to run the client dev server, it bombs out with the following message:
Module not found: Error: Cannot resolve module 'react-dom/lib/getVendorPrefixEventName in: c:....ReactTransitionEvents.js
When I locate ReactTransitionEvents.js on my hard drive and look at it, I can see a require statement for getVendorPrefixEventName:
var getVendorPrefixedEventName = require('react-dom/lib/getVendorPrefixedEventName');
Is this looking for the lib folder in the react-dom folder in the main node_modules folder?
Related
I have installed an npm package on my react application but everytime I try to compile I get this error:
Module not found: Error: Can't resolve 'serialport' in 'C:\Users\Username\Desktop\ProjectGroup\c-test\src'
I have checked the node_modules folder and it is in fact in that folder.
i have also tried to install it again but it still throws the same error.
How would I go about fixing this?
As shown in comments, you installed only the types which are usefull for TypeScript.
Run npm i serialport
I am trying to deploy my site to netlify but i keep getting this error
Module not found: Error: Can't resolve './components/Scrolltotop' in
'/opt/build/repo/src'
i dont have this import statement anywhere in my code.
Screenshot
This is my import statement
On my localhost server i am not getting any error. Why is the deployment failing?
UPDATE
I have corrected the filename casing in github ie from Scrolltotop.js to ScrollToTop.js but the error is not gone
What Solved it for me was to move the folder up a directory. I simply changed the location of the folder and did a git push. You could also try renaming the folder and do a git push.
I am trying to get the version number of an external package like this:
import * as packageInfo from "<package_name>/package.json";
...
console.log(packageInfo.version);
There is no error in code editor, but my build fails with error:
Module not found: Error: Package path ./package.json is not exported from package
But I can see the package.json in node_modules respective package folder. Any idea what could be wrong here?
I recently published a simple React module that I wrote in TypeScript. I tested my module by importing the local package into a project, and it worked flawlessly. However, now that I've published the module, whenever I try to import it into a project, I get the following error:
Failed to compile.
./src/...
Module not found: Can't resolve '<module>' in '.../src/...'
Package is listed in both package.json and package-lock.json, and the module shows up in node_modules. Additionally, VS Code doesn't throw any fits, so I'm not quite sure what could be the issue.
NPM, being the "Node Package Manager" interprets packages as node modules. in the documentation, it says it will try to load a folder by looking for a package.json file, and resolving the path in main relative to the folder it found.
So when publishing a package with a build step, always make sure to build it before its published (there is a prepublish hook for this, in the scripts object in package.json).
The other thing is to make sure that the package being published refers to the correct main, bin (if applicable), and module (if applicable) paths in the package.json file. if the source file is src/mylib.coffee and the built file is dist/mylib.js, the package.json must contain { "main": "dist/mylib.js" } in order that someone installing this module as a dependency into their node_modules folder would require the correct file.
in short make sure "main" in package.json points to the right file!
I am trying to compile my first React Native project, and it all works fine from the CLI, until I try to install a new library.
After installing any library, I get various errors, culminating in this:
error: bundling failed: Error: While trying to resolve module `react` from file `/Users/myname/Desktop/Projects/ProjectName/App.js`, the package `/Users/myname/Desktop/Projects/ProjectName/node_modules/react/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/myname/Desktop/Projects/ProjectName/node_modules/react/index.js`. Indeed, none of these files exist:
I have, indeed, confirmed that those files exist.
What is going on here? I'm constantly having these errors as I am trying to use React Native, even when rebuilding the app multiple times and trying over.
Do the following steps:
Stop metro bundler
Delete node_modules folder
cd into your project folder and run:
'npm install'