Reputation: 597
I was learning React.js by following some video tutorial. It was working fine but today I continued the work and added state to my component and suddenly after saving I am getting babel-core
error.
I am new to React so I can't understand what error is this, and I think it's not related with changing of components I made today.
I have also uploaded my project till this point on github here
On webpage I get this error message -
Failed to compile
./node_modules/babel-core/lib/helpers/resolve.js
Module not found: Can't resolve 'module' in 'C:\Users\Sachin Verma\Desktop\WebD work\React\The Burger Builder\node_modules\babel-core\lib\helpers'
In console I get this long error -
Uncaught Error: Cannot find module "module"
at webpackMissingModule (resolve.js:34)
at Object.<anonymous> (resolve.js:34)
at Object../node_modules/babel-core/lib/helpers/resolve.js (resolve.js:46)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/lib/helpers/resolve-from-possible-names.js (resolve-from-possible-names.js:6)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (resolve-plugin.js:6)
at Object../node_modules/babel-core/lib/helpers/resolve-plugin.js (resolve-plugin.js:21)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (option-manager.js:43)
at Object../node_modules/babel-core/lib/transformation/file/options/option-manager.js (option-manager.js:383)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (index.js:42)
at Object../node_modules/babel-core/lib/transformation/file/index.js (index.js:737)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/lib/api/node.js (node.js:6)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/index.js (index.js:1)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/components/Burger/Burger.js (Burger.css:26)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/containers/BurgerBuilder/BurgerBuilder.js (Layout.js:15)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/App.js (fetch.js:461)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/index.js (index.css?f255:26)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.0 (registerServiceWorker.js:117)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at bootstrap 8d64744152fbd1b327ed:724
at bootstrap 8d64744152fbd1b327ed:724
index.js:2178 ./node_modules/babel-core/lib/helpers/resolve.js
Module not found: Can't resolve 'module' in 'C:\Users\Sachin Verma\Desktop\WebD work\React\The Burger Builder\node_modules\babel-core\lib\helpers'
Update:
I ran npm run eject
to add some configs so that class names in component's css files do not clash with each other.
I added these two lines.
Upvotes: 0
Views: 885
Reputation: 31
I guess you have taken the Maximilian class of React on Udemy and you encountered this issue in section 8 - Lesson 129. This is because when you tried to create the variable transformedIngredient you might have got a suggestion of transform keyword which is reserved keyword in babel-core that got imported on the top of your js file. Remove that and you are good to go.
Upvotes: 3
Reputation: 169416
That particular error is caused by you having inadvertently added this import from the babel-core
library you don't have installed:
import { transform } from 'babel-core';
Remove the line and you're good to go.
However, I still wonder why you've done react-scripts eject
in your repo...
Upvotes: 2