I get webpack not installed, but webpack --version finds webpack - reactjs

I am following this tutorial to create a React project with webpack. Everything went smooth until step 4 webpack --config webpack.config.js, where I get this error:
webpack not installed
Install webpack to start bundling:
$ npm install --save-dev webpack
But if I type webpack --version, I get 4.43.0.
I don't know what is wrong.

Based on the information you gave, your webpack.config.js might be invalid, e.g., importing missing module, or not exporting proper configuration.
See this issue for more context:
https://github.com/webpack/webpack/issues/9242#issuecomment-500350448

Related

How can i solve cant find module: "sass" error?

I'm new to react and decided to try another method to start a project instead of create-react-app which i regret, I used a site createapp.dev which uses a parcel bundler instead of react-scripts bundler so after i was done with the project i tried deploying it to github pages but could not i've read the parcel documentation but still no help so i restarted the project with create-react-app then copied the code but now i'm swimming in a bunch of errors
1.Install missed packages
if you use:
1.npm : npm install --save react-router-dom sass-loader sass
2. yarn : yarn add react-router-dom sass-loader sass

Problem with project dependency tree in Create React App

I've cloned a GitHub repo and was installing the packages. I first ran yarn install, and then I ran yarn build. But the second command gave me an error:
Could somebody help me with this please? I would really appreciate it! Thank you!
I had a similar issue, and it was because I had installed webpack in previous directories. You have probably installed a webpack in C:\Users\eden1\node_modules. Try removing that with npm remove webpack when you are located in C:\Users\eden1 or remove the globally installed webpack with npm remove -g webpack.

Error with scss when importing to index.js

I have installed node sass
converted my css to scss. Imported my main.scss into my index.js. Then I try to run it and I get that error.
Error I am getting in the console
Your scss files are being parsed by babel-loader which is causing the above error. If you are using webpack, you need to add sass-loader into the config to parse the required files.
If you are using create-react-app, you need to install node-sass and it should work.
$ npm install node-sass --save-dev

Can't resolve babel loader in node_modules

After npm install of react-facebook-login I get an error:
Failed to compile.
./node_modules/react-facebook-login/dist/facebook-login-with-button.js
Module not found: Can't resolve 'C:\Users\ichen\Developer\plain\Strapi.POC\client\node_modules\react-scripts\node_modules\babel-loader\lib\index.js' in 'C:\Users\ichen\Developer\plain\Strapi.POC\client'
I think its because the package specifies in its package.json, under devDependencies "babel-loader": "^6.2.4" and React is using babel-loader > 7
I'm not really sure though. What should I do? I don't want to eject the React App to downgrade the babel version...
In the end I changed the babel-loader in the package.json of the dependency from 6.2.4 to 8.0 (the one used by React currently), saved the file, re-ran npm start, and everything compiled.

I am not able to build it using yarn

I am not able to build my react app using yarn run build;prod
Failed to minify the code from this file:
./node_modules/map-age-cleaner/dist/index.js:15
Is not Yarn problem you just spell it wrong.
Instead using yarn run build use yarn build.
This worked for me.
Yarn has nothing to do with minification.
Minification depends to webpack/parcel or the bundler you are using.

Resources