reactjs-basics icon indicating copy to clipboard operation
reactjs-basics copied to clipboard

Error on "npm start"

Open sonakshisaxena1 opened this issue 6 years ago • 9 comments

I am getting the following error when I type npm start in terminal"

ERROR in Entry module not found: Error: Can't resolve './src' in '/Users/sona/Documents/reactjs-basics'

screen shot 2018-03-30 at 1 31 46 am

sonakshisaxena1 avatar Mar 29 '18 20:03 sonakshisaxena1

Yeah, I'm getting the same.

nick-gibb avatar Apr 21 '18 00:04 nick-gibb

@sonakshisaxena1 , @nick-gibb Could you please upload your webpack.config.js file? In webpack.config.js file loaders option have been replaced with rules. Hope it helps!

imtiaz-emu avatar Apr 22 '18 08:04 imtiaz-emu

@sonakshisaxena1 @nick-gibb "loaders" is deprecated, use "Rule.use" instead. Also on a side note I think you can use a different dependency called "babel-preset-env" instead of es2015 since its kinda old

MegazeroMZ avatar Apr 25 '18 01:04 MegazeroMZ

@MegazeroMZ @imtiaz-emu , can you give an example on how to use Rule.use ??

shuvo0074 avatar Jun 11 '18 05:06 shuvo0074

@shuvo0074 something like this

module: { rules: [ { use: [ { loader: "babel-loader", query: { presets: ["env", "react", "stage-2"] } } ] } ] }

MegazeroMZ avatar Jun 11 '18 11:06 MegazeroMZ

I am also getting same issues.

hitu4233 avatar Jun 20 '18 08:06 hitu4233

@hitu4233 ,

  1. Instead of babel-preset-es2015, npm install "babel-preset-env"
  2. In webpack.config.js , write "rules" instead of "loaders"
  3. in package.json , replace "cp" with "copyfiles" at line 8 and 9. These things solved my problems in windows platform. Or you can fork this repository: https://github.com/shuvo0074/React.js-initial to start a new project, all issues are solved and all packages are included.

shuvo0074 avatar Jun 20 '18 08:06 shuvo0074

@sonakshisaxena1 @nick-gibb Are you using windows? If yes then change the forward slashes(/) to backward slashes(\) in package.json file, also change the cp command to copy and try. Let me know for further issue.

nitinprajapati avatar Aug 04 '18 08:08 nitinprajapati