How to fix Error cannot find module 'core-js/es6'
13,527
For core.js v3.9 import in App.tsx the next line: import "core-js/es";
Related videos on Youtube
Author by
bstwagir
Updated on June 04, 2022Comments
-
bstwagir almost 2 years
I have been getting an error regardless of what I do. In fact I am building an app with mongoDB as a server using mongoose and babel-watch, but every time I run
babel-watch
I get this error:Error cannot find module 'core-js/es6'
I have installed and reinstalled
core.js
usingnpm install core.js
, however nothing changes. Please help.These are the dependencies I have installed on my project:
"dependencies": { "body-parser": "^1.19.0", "core-js": "^2.6", "cuid": "^2.1.6", "express": "^4.17.1", "limax": "^1.7.0", "mongoose": "^5.6.9", "node-gyp": "^5.0.3" }, "devDependencies": { "babel-cli": "^6.26.0", "babel-core": "^6.26.3", "babel-loader": "^8.0.6", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-0": "^6.24.1", "babel-watch": "^7.0.0", "nodemon": "^1.19.1" } }
-
technicallynick almost 5 yearsThis might be related to the version of core-js you're using. It may be looking for 'core-js/library/es6' instead of 'core-js/es6'. (npmjs.com/package/core-js/v/2.6.8#core-js)
-
bstwagir almost 5 yearsSo what do you suggest that I do?
-
technicallynick almost 5 yearsLook in the node_modules folder for the package you're looking for to see where they put it. If you provide us with the version your using, we should be able to look at the npm package and give you better direction.
-
bstwagir almost 5 yearsthe version is core.js ^2.6.9
-
Ahmed Waqas almost 5 yearsare you importing core-js/es6 anywhere in your application. you can't do that either import it core-js/es or only import the feature you need. please go through the documentation here if you are still confused. github.com/zloirock/core-js/blob/master/README.md
-
-
bstwagir almost 5 yearsSo I changed the path in the entry point of the app as suggested, but the same error still reoccurs, I then installed core-js v3.2.1, and still the error remains, I even tried using different paths using recommendations from the documentation but nothing works. And in my
node_modules/core-js
folder there is nolibrary
folder! -
technicallynick almost 5 yearsCan you run
ls -al node_modules/core-js
and show us what IS in there? -
bstwagir almost 5 years
ls al
command doesn't work. I just usedls
<br/>Mode Length Name<br/> ---- ------ ----<br/> d----- es<br/> d----- features<br/> d----- internals<br/> d----- modules<br/> d----- proposals<br/> d----- scripts<br/> d----- stable<br/> d----- stage<br/> d----- web<br/> -a---- 600 configurator.js<br/> -a---- 106 index.js<br/> -a---- 1064 LICENSE<br/> -a---- 1811 package.json<br/> -a---- 5499 README.md<br/> -
technicallynick almost 5 yearscore-js documentation for 3.2.1 indicates that it no longer supports the ability to import a specific ES subset. You can just do
core-js/es
to import all stable ES features. github.com/zloirock/core-js/blob/master/README.md#commonjs-api -
bstwagir almost 5 yearsI tried that too, and the same error keeps getting thrown.