create-react-app aborting with code ENOENT - javascript

Just started out with React using an online course from Udemy. For some reason my create-react-app stopped working all of a sudden and it shows this log.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Users\Vahram\Desktop\Udemy-React\Personal-Notes\Sec5\pokedex-exercise\node_modules\postcss-normalize
npm ERR! dest C:\Users\Vahram\Desktop\Udemy-React\Personal-Notes\Sec5\pokedex-exercise\node_modules\.postcss-normalize.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Vahram\Desktop\Udemy-React\Personal-Notes\Sec5\pokedex-exercise\node_modules\postcss-normalize' -> 'C:\Users\Vahram\Desktop\Udemy-React\Personal-Notes\Sec5\pokedex-exercise\node_modules\.postcss-normalize.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Vahram\AppData\Roaming\npm-cache\_logs\2021-05-06T21_38_53_463Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting pokedex-exercise/ from C:\Users\Vahram\Desktop\Udemy-React\Personal-Notes\Sec5
Done.
I checked out similar questions on here and there were some solutions I tried. The usual answer is to delete package.json but I don't have that seeing as I'm trying to make a new React app. Here's what I've tried so far:
Originally tried npx create-react-app my_app
Then tried running npm install -g create-react-app and then create-react-app my_app.
Then tried npm cache clean --force followed by npm rebuild then step 2 again.
Then tried npm init --yes to generate a package.json file, followed by trying to make a new app again using CRA.
Tried restarting the machine
Curious thing I noticed that I'm not sure is related to the issue:
When I go to Task Manager, there are two Node.js processes running. When I try to end one, it spawns another Node.js process... I can't get rid of all Node.js processes. This is why I originally restarted the machine.
Any help is appreciated! I have no idea how to proceed... I'm even thinking of formatting my machine and starting everything from scratch. However, I'd like to know why this happens so that I can avoid it in the future.

I just solved this using the following command.
npm uninstall -g create-react-app
and then:
npm install -g create-react-app
Regards

Related

Cannot use create-react-app as it shows below error

PS D:\Reactjs> npx create-react-app textutils
Creating a new React app in D:\Reactjs\textutils.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/#typescript-eslint%2fscope-manager reason: Invalid response body while trying to fetch https://registry.npmjs.org/#typescript-eslint%2fscope-manager: read ECONNRESET
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ashes10\AppData\Local\npm-cache_logs\2022-08-22T05_43_38_991Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting textutils/ from D:\Reactjs
Done.
Maybe this gonna work
npm cache clean --force
Might be because of the cache issue. To fix this, try the below command,
npm cache clean --force
If the issue still persists. Run the below command to install create-react-app,
npm install -g create-react-app
And then, Try creating your react application,
npx create-react-app appname
try to run the command line as administrator
then
cd <your desired location to create the project>
npx create-react-app <project name>

Unable to install a npm package and dependency

I'm trying to adapt an external API named cric-live into my node application for displaying cricket scores in my application. When I try to install the dependency, it shows an error as below
PS F:\Node Express\NodeJS\cric api> npm i cric-live
npm ERR! Unexpected end of JSON input while parsing near '...":"request-promise","'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Thiluxan\AppData\Roaming\npm-cache\_logs\2020-07-01T04_51_42_400Z-debug.log
This is the source link for the dependency I'm trying to install
https://www.npmjs.com/package/cric-live?activeTab=readme
Your npm cache maybe busted so I would say run this code first and try installing the package again
npm cache clean --force

Unable to install node modules because 'This is related to npm not being able to find a file.'

So in my recent project I tried to install some node modules, in this case, express and MySQL, which both return the same error:
npm WARN thecaptain.ga#1.0.0 No repository field.
npm ERR! path C:\Users\user\projectroot\node_modules\on-finished
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\user\projectroot\node_modules\on-
finished' -> 'C:\Users\user\projectroot\node_modules.on-finished.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
I tried to delete all the related files, then reinstalling it, however that did not change anything. I have run npm init before the install even attempted to fill in the dependency manually, to then run npm install. It happens with every node module in any node project I have.
Turns out the issue was because the dropbox tried to synchronize the files as i was installing the package. Pausing or disabling this fixes the issue...
Could you try this please:
1 - Ensure no NPM scripts are running.
2 - Navigate to your project route
3 - Run this command:
rm package-lock.json && npm i
Note - it may also be worth trying to delete your 'node_modules' folder in your project directory and running the above command.

React keeps aborting installation when I try the tutorial

I was trying to follow the tutorial on the react website today but for whatever reason it doesnt want to work for me when i run the command:
npx create-react-app my-app
`I get the following error message;
Creating a new React app in D:\NodeJs\react\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for postcss#^7.0.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'autoprefixer'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\matth\AppData\Roaming\npm-cache\_logs\2019-01-
12T17_55_39_805Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-
scripts has failed.
Deleting generated file... package.json
Deleting my-app/ from D:\NodeJs\react
Done.`
My npm version is 6.5.0 and Node is 11.6.0
Not sure what the heck is going on as when I did this on my work laptop it worked without any issues with the exact same versions of node and npm
I was fix problem when I error create-react-app
Err: code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
I had rename file .npmrc --> .npmrc-old
C:\Users\you\.npmrc
And I success >>> I feel perfect
-
Or can you fix:
--> use git bash terminal
Just an update for everyone. It worked now. All I did was reinstall nodejs for the 4th time, nothing else. Makes 0 sense. anyways, thanks for your answers, appreciate it.
I also got a same error.
Try to run npm cache clean --force after that just run create-react-app
Definitely It will work

NPM not working (Cannot find module 'internal/fs' - nodejs)

NPM error on update. I recently update to Node version 7.x. Now npm is not working.
I am unable to locate the error, it may be due to -
npm ERR! Cannot find module 'internal/fs'.
I get the following when I run sudo npm update -g -
npm ERR! Linux 3.13.0-101-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" "-g"
npm ERR! node v7.1.0
npm ERR! npm v3.10.8
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
My /etc/profile.d/nodejs.sh has the following contents:
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export NODE_PATH
You should be able to remove the npm directory (typically /usr/local/lib/node_modules/npm) and then reinstall one of the official node tarballs, which includes npm (you can find the latest from http://nodejs.org/dist/latest-v7.x/).
Did you upgrade from an older version of node?
If so, that is probably part of the reason why you are having this issue. Older versions of graceful-fs (a dependency of npm) did things that are no longer available in node v7.
According to this thread, updating npm to version 4 will solve your problem, try:
npm i -g npm#4
If this doesn't work, try:
~/.n/n/versions/node/7.0.0/bin/npm i -g npm#4
delete node_modules directory and then type in your console "npm install". For a reason that I dont know, if you only update npm, it does not fix the error, but re-installing npm everything is gonna be allright.
For me, if I facing error "cannot find module internal/fs", it would be refer to command path. Better find the command path:
npm config get prefix
put into system environment path.
It is worked for me after facing the error several days.

Categories