• Register
0 votes
355 views

Problem :

I have the React project using the Webpack and Babel. When I created it on the office computer, my Webpack ran fine. But when I cloned my project onto the personal computer, it gave me below error :

ERROR in ./react_minesweeper.jsx
Module build failed: Error: Couldn't find preset "es2015" relative to directory "/Users/alecxe/Desktop"at /alecxe/louisstephancruz/Desktop/w6d5/minesweeper/node_modules/babel-core/lib/transformation/file/options/option-manager.js:298:19 at Array.map (native) at OptionManager.resolvePresets (/Users/alecxe/Desktop/w6d5/minesweeper/node_modules/babel-core/lib/transformation/file/options/option-manager.js:269:20)

 

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

1.  Command npm i or npm install :

You should install all your packages in the package.json dependencies and the dev dependencies

2.  To check if you have the particular package installed :

You can use the below command to check particular package

npm ls babel-preset-es2015

3.  If for some of the reason the NODE_ENV is production and you want to install dev dependencies then you can use:

npm install --only=dev

4.  The below command can be used on the production machines that are dealing with the already built code and do not need the access to any of the development dependencies:

npm install --only=prod

5.  I want to recommend creating the .babelrc in your root of the repo with a below content:

{"presets": [ "es2015", "react" ] }

6.  For your webpack config you must want to specify some of the other options:

{ context: __dirname, resolve: { root: __dirname, extensions: [ '.js', '.jsx', '.json' ] }}

This will resolve your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 1.7K views
1.7K views
Problem : I have a carousel file in which I want to get my index.js and build the block.build.js, and my webpack.config.js But I face below error message: ERROR in ./index.js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. Does anyone know the solution on this?
asked Jan 18, 2020 jwilliam 3.9k points
0 votes
1 answer 2K views
2K views
Problem : While I was trying to set up the React within Django project I came across below error ModuleBuildError in Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: C:\Users\jwilliam\Cebula3\cebula_react\assets\js\index.js: Support for the ... : [ "@babel/plugin-proposal-class-properties" ] } But the above error is still existed, How can I fix the error??
asked Jan 20, 2020 jwilliam 3.9k points
1 vote
1 answer 730 views
730 views
Problem : Currently I am trying to learn the Node, Webpack , Babel. I have recently joined a new project so need to learn these three technologies. Now I am facing below error while trying to build my project. “Module build failed (from ./node_modules/babel-loader/lib/index.js)”. ... .7.0", "webpack": "^4.17.1", "webpack-dev-server": "^3.1.7" } Please guide me in fixing above error.
asked Mar 31, 2020 morrisBson 3.2k points
0 votes
1 answer 363 views
363 views
Problem: I have recently started learning about React, Babel, JSX and JS. Now I am receiving an error from a babel if I tried to compile my JSX code into a JS code. Please find the error: “Jsx value should be either an expression or a quoted jsx text.&rdquo ... out in my searching on interenet that prop values should be passed only between {}, but adding these to my code did not help me.
asked Aug 13, 2020 Raphael Pacheco 4.9k points
1 vote
2 answers 392 views
392 views
Problem : I am very new to Ionic, I have recently started working on Ionic but I am facing below error: Runtime Error Uncaught (in promise): Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/stewart/Development/ionic/theWhoZoo/src/pages ... say they do match. import { MyRatingModel } from '../model/myratingModel'; How can I fix above error need Ionic expert help.
asked Apr 22, 2020 stewart 4k points
0 votes
1 answer 416 views
416 views
Problem : I have created the new React application by just using create-react-app and I amtrying to write a unit test to the component named "MessageBox" that I have created in the application. I have also added the file under my 'src' folder named 'setupTests.js ... an adapter, you should call msenzyme.configure({ > adapter: new Adapter() }) Does someone know how can I solve this problem?
asked Dec 19, 2019 alecxe 7.5k points
1 vote
1 answer 432 views
432 views
Problem : I am naïve to Webpack. As the Webpack does not support the native webworker syntax so currently I want to use a worker-loader npm module but because of some unknown reason t I am facing the below weird error. Cannot assign to read only property 'exports ... but still unable to understand the root cause of above error. Now I am in badly need of the expert advice to fix above error.
asked Apr 9, 2020 morrisBson 3.2k points
0 votes
1 answer 713 views
713 views
Problem : I am new to npm and now I am facing strange looking below error “Error: EACCES: permission denied, access '/usr/local/lib/node_modules'” Detailed error as below: npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ... code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } Have somebody fixed this before?
asked Feb 20, 2020 mphil 2.3k points
0 votes
2 answers 933 views
933 views
Problem : Facing below error: Unhandled Rejection (Error): Actions must be plain objects. Use custom middleware for async actions. I wanted to add comments with all posts. So when fetch posts are run I want to call fetch comment API for every post. export function ... API.fetchComments(postAllId).then(comments => {     return {       type: BIND_COMMENTS,       comments,       posAlltId     }  }) }
asked Jan 17, 2020 jwilliam 3.9k points