Failed to compile. webpack is not a function - reactjs

My project was working fine but after installing react-redux and redux i can't start the project it shows me this error
Failed to compile.
webpack is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project#0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The screenshot of error in ternimal

I ran into a problem with this same symptom after upgrading all of my node modules including react and redux, but in particular react-dev-utils to v8.0.0. The createCompiler() function has been changed to expect an object rather than multiple parameters (I guess this will provide greater flexibility in the future).
I changed my start.js from:
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
to:
const compiler = createCompiler({ webpack, config, appName, urls, useYarn });

Simple npm install command worked form me

Related

Failed to minify the code from this file: node_modules/react-router-dom/index.js:74

This is a react project. I am getting when i try to do npm run build. Have no idea why it suddenly starts behaving this way.
I am using react-router, react-router-dom version 6.2.1 and react-scripts version 5.0.0. So not sure what's the actual issue.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abc-app build: `node dev/scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the abc-app build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

React Native Setup

I am new to react native and I am trying to set it up using the tutorial from this youtube video:https://www.youtube.com/watch?v=0-S5a0eXPoc&t=811s
However, I am getting errors whenever I try to run the program.
When I run it using expo start I get this error:
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
And when I run it using npm start, i get this:
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I tried some solutions from here: error: This is probably not a problem with npm. There is likely additional logging output above
But they did not work.

snowpack Package "abstracts/variables" not found. Have you installed it? getting this error while running npm start

I got this error while running npm start
used snowpack.dev https://www.snowpack.dev/
snow
[snowpack] ! updating dependencies...
[snowpack] ! installing dependencies…
[snowpack] Package "abstracts/variables" not found. Have you installed it?
[snowpack] Install failed.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `snowpack dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2020-09-15T12_18_05_035Z-debug.log
PS G:\antonio\projects\react\app>
Are you using baseUrl in tsconfig.json?
If you are importing ./src/abstracts as abstracts/[whateverfile] via the baseUrl configuration, you will need to setup an alias (Docs here) in your snowpack configuration file.
Create snowpack.config.js if you have not already done so. Place it in the root of your application, alongside your package.json.
In snowpack.config.js, add:
module.exports = {
...
alias: {
abstracts: '/src/abstracts',
// continue for remaining directories in /src
},
...
}

NPM ERR! CODE EINTEGRITY when i run create react app

I tried starting a new react project and i kept getting this error
npm ERR! code EINTEGRITY
npm ERR! errno EINTEGRITY
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/default-gateway: Integrity verification failed for sha512-XNq1bW+TSjcWkvLm57AQGDZuMWP+o91SzJFSO/wm6OJyCzHQBgEh6ltY91FHduphvXq1p6szX47GjsuhU2W05Q== (C:\Users\LENOVO\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\5c\da\b56d6f934a371692f2e6e7b01018366e3163fea3dd52cc91523bfc26e8e2720b31d0060121ea5b58f7514776ea61bd7ab5a7ab335f8ec68ecba15365b4e5)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LENOVO\AppData\Roaming\npm-cache\_logs\2019-10-15T07_32_25_495Z-debug.log
Aborting installation.
i have tried updating NPM but it just does not seem to work!
This worked for me:
npm cache verify
or you can try
npm cache clean --force
I had the same issue.
It worked for me after removing the spaces in the directories name,
e.g.
C:\Users\LENOVO\React Projects\webapp
becomes
C:\Users\LENOVO\React_Projects\webapp

create-react-app npm run build fail to minify watson node sdk

I am new to React and I am trying to build a react app using create-react-app and Watson node-sdk. Everything works fine in development mode after running npm start. But when I try to build a production package using npm run build and below is the error I receive.
e:\Microsoft\Workspace\React\myapp>npm run build
> myapp#0.1.0 build e:\Microsoft\Workspace\React\myapp
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/watson-developer-cloud/lib/helper.js:31
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yk\AppData\Roaming\npm-cache\_logs\2017-09-
20T09_40_36_144Z-debug.log
The line that giving error is let missing; and seems like the let is causing the issue. Is there anything I can do with this?
Encountered this problem today. the doc suggests some solutions:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
Fork the package and publish a corrected version yourself.
If the dependency is small enough, copy it to your src/ folder and treat it as application code.
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

Resources