Installed bootstrap via npm on my react project
Importing bootstrap
import 'bootstrap/dist/css/bootstrap.min.css';
but it outputs an error: Cannot find module 'D:\project\my-app\node_modules\schema-utils\src\index.js'. Please verify that the package.json has a valid "main" entry
The main field is a module ID that is the primary entry point to your program. That is, if your package is named foo, and a user installs it, and then does require("foo"), then your main module's exports object will be returned. This should be a module ID relative to the root of your package folder.
package-lock. json is automatically generated for any operations where npm modifies either the node_modules tree, or package. json . It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.
json intact. It is highly recommended you commit the generated package lock to source control: this will allow anyone else on your team, your deployments, your CI/continuous integration, and anyone else who runs npm install in your package source to get the exact same dependency tree that you were developing on.
To remove a dev dependency, you need to attach the -D or --save-dev flag to the npm uninstall, and then specify the name of the package. You must run the command in the directory (folder) where the dependency is located.
Try deleting package-lock.json
and run npm install
Verify that in your package.json
file there is an entry for main
, usually something like "main": "dist/cjs"
If you're using yarn
try deleting yarn.lock
and run yarn
again.
Try to use "npm update --force" which resolves my issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With