How to fix npm start error in my react app? - reactjs

Getting the following error when I run npm start in my newly created react app that I created using npx create-react-app my-app. I tried uninstalling create react app globally and then updating my node.js version to the latest available but still getting this error. Any advice on how to fix this?
I'm on mac os
Thanks
internal/modules/cjs/loader.js:614
throw e;
^
Error: No valid exports main found for '/Users/quinnbarnett/Desktop/ugh/ugh/node_modules/postcss-safe-parser/node_modules/postcss'
at resolveExportsTarget (internal/modules/cjs/loader.js:611:9)
at applyExports (internal/modules/cjs/loader.js:492:14)
at resolveExports (internal/modules/cjs/loader.js:541:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:643:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:941:27)
at Function.Module._load (internal/modules/cjs/loader.js:847:27)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at Object.<anonymous> (/Users/quinnbarnett/Desktop/ugh/ugh/node_modules/postcss-safe-parser/lib/safe-parse.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1121:30) {
code: 'MODULE_NOT_FOUND'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ugh#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ugh#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. ```

Try update to min v14.5 for your node.
Try installing autoprefixer#9.8.0 with npm i autoprefixer#9.8.0
It looks like a bug in node.js and there's an issue open for it.
https://github.com/facebook/create-react-app/issues/9273

Related

Npm run build on my react app project doesn't work

When i start my react project all seems good, but when i try to build this, it doesn't work, i have this error :
node:internal/fs/utils:344
throw err;
^
Error: UNKNOWN: unknown error, lstat 'C:\Users\darkx\Bureau\mlvojobs\mlvojobs\node_modules\fs-extra\lib\util'
at Object.realpathSync (node:fs:2490:7)
at toRealPath (node:internal/modules/cjs/loader:394:13)
at tryFile (node:internal/modules/cjs/loader:390:10)
at tryExtensions (node:internal/modules/cjs/loader:402:22)
at Function.Module._findPath (node:internal/modules/cjs/loader:558:20)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\darkx\Bureau\mlvojobs\mlvojobs\node_modules\fs-extra\lib\copy\copy.js:7:22) {
errno: -4094,
syscall: 'lstat',
code: 'UNKNOWN',
path: 'C:\\Users\\darkx\\Bureau\\mlvojobs\\mlvojobs\\node_modules\\fs-extra\\lib\\util'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mlvojobs#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mlvojobs#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\darkx\AppData\Roaming\npm-cache\_logs\2022-08-18T22_53_48_493Z-debug.log
PS C:\Users\darkx\Bureau\mlvojobs\mlvojobs> npm install fs-extra
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\darkx\AppData\Roaming\npm-cache\_logs\2022-08-18T22_54_15_541Z-debug.log
And when i try to install something with npm it says :
npm ERR! cb.apply is not a function
Node.js sometimes works weird. I encountered this error, my option is switch to another Node.js version.
I recommend using nvm-windows (seem like you're using Windows)
You can install latest Node.js version lts
nvm install lts
Or specific version, for example:
nvm install 16.16.0
Then delete your project node_modules and run:
npm install
Finally, build your project again. Let me know if it work!
Possible solution :
Go to : C:\Users(your username)\AppData\Roaming
Delete the npm folder and if there is one npm cache folder.
Run npm cache clean —force
it should work

How to install a reactJs module/package without using npm?

currently I am using ResizableRect imported from this module mockingbot/react-resizable-rotatable-draggable. But it is unable to resize or drag the ResizableRect on the mobile browser and touching event is not available.
Then, I found this module rinose/react-resizable-rotatable-draggable, which has the touching event. However, there is no clear instruction on how to install the rinose's module as the content in README.md in rinose's module is exactly the same as that in mockingbot's module.
May I know how to import rinose's module into my project without using npm? Thanks!
UPDATE
I tried 'npm install git+https://github.com/rinose/react-resizable-rotatable-draggable.git' suggested by Antoine Raoul Iscaros but it still doesn't work. It stated that 'rollup-plugin-babel' module is not found though I had installed the module(which is already deprecated). Below are the error logs
react-resizable-rotatable-draggable-touch#0.3.0-dev.0 prepack C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2
> npm run build
> react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2
> rollup -c
[!] Error: Cannot find module 'rollup-plugin-babel'
Require stack:
- C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup
Error: Cannot find module 'rollup-plugin-babel'
Require stack:
- C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js
- C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Forge-15\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-1a6e54a2\rollup.config.js:5:13)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.require.extensions.<computed> [as .js] (C:\Users\Forge-15\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js:508:20)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build: `rollup -c`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-resizable-rotatable-draggable-touch#0.3.0-dev.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Forge-15\AppData\Roaming\npm-cache\_logs\2020-08-28T04_25_05_798Z-debug.log
npm ERR! premature close
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Forge-15\AppData\Roaming\npm-cache\_logs\2020-08-28T04_25_05_840Z-debug.log
you can install directly from git using
npm install git+https://github.com/rinose/react-resizable-rotatable-draggable.git
Question is already answered here How to install an npm package from GitHub directly?

npm ERR This is probably not a problem with npm. There is likely additional logging output above

It happens when I try to start server. This is probably not a problem with npm. There is likely additional logging output above.
I got everything updated and still same.
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module '/Users/Mateusz/Documents/reactWebsite/node_modules/webpack-dev-server/bin/webpack-dev-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! redux-simple-starter#1.0.0 start: `node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the redux-simple-starter#1.0.0 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! /Users/Mateusz/.npm/_logs/2020-02-20T09_12_14_220Z-debug.log`enter code here`
I don't know the why this error occurs, but I once got this error and solved through the following steps:
Delete node_modules and package-lock.json
Run npm install
Start the server again

`npm start` not working for my create-react-app application. Missing template?

I typically just run npm start for my create-react-app project but after I restarted my computer I can no longer do it and get this weird error:
module.js:341
throw err;
^
Error: Cannot find module './Template'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/Users/richardbustos/Google Drive/workspace/portfolio/node_modules/webpack/lib/MainTemplate.js:8:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! portfolio#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio#0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the portfolio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs portfolio
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls portfolio
npm ERR! There is likely additional logging output above.
I tried running npm install and updating npm and npde but nothing worked
Ahh found a fix. All i had to do was:
rm -rf node_module
to clean then ran
npm install
That seemed to work =)
I had the same issue running the npm start command.
Installing the npm version 4.6.1 helped me solve the problem. I hope it is helpful for some of you.

Error when trying to deploy node.js on Google App Engine

I am getting errors when trying to deploy Node.js app to Google App Engine. Node.js run time get crashed with require statement. What am I wrong?
Directory structure:
|--app
---protocol.js
app.js .....
In file app.js
.....
var protocol = require('./app/protocol');
....
When deploying with gcloud:
gcloud app deploy app.yaml
then errors:
> nodejs-getting-started#1.0.0 start /app
> node app.js
module.js:471
throw err;
^
Error: Cannot find module './app/protocol'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/app/app.js:21:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! nodejs-getting-started#1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-getting-started#1.0.0 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodejs-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nodejs-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nodejs-getting-started
npm ERR! There is likely additional logging output above.
The error was reported to the google SDK issue reporting,
https://code.google.com/p/google-cloud-sdk/issues/detail?id=1431
It was solved by downgrading to 137.0.1
gcloud components update --version=137.0.1
and redoing the process.
I was having a similar issue trying to deploy a Sails.js project. Downgrading gcloud from 138.0.0 to 137.0.1 also fixed my issue.

Resources