Got an error while executing "create-react-app my-app" - node.js

I'm new to NodeJS.
I have excuted the follwing commands.
1.npm install -g create-react-app
2.create-react-app my-app
while executing the 2nd command i got an error like this
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
uglifyjs-webpack-plugin#0.4.6 postinstall
E:\Projects\HighAvenue\Dashboard\dashboard\node_modules\uglifyjs-webpack-plugin
node lib/post_install.js
npm ERR! file bash npm ERR! path bash npm ERR! code ELIFECYCLE npm
ERR! errno ENOENT npm ERR! syscall spawn bash npm ERR!
uglifyjs-webpack-plugin#0.4.6 postinstall: node lib/post_install.js
npm ERR! spawn bash ENOENT npm ERR! npm ERR! Failed at the
uglifyjs-webpack-plugin#0.4.6 postinstall 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\Soorya\AppData\Roaming\npm-cache_logs\2018-06-26T05_00_45_645Z-debug.log
Aborting installation. npm install --save --save-exact --loglevel
error react react-dom react-scripts has failed.

Thanyou all for your reply.
I have fixed this issue after installing yarn.
Thankyou

Have you permission for create folder at that location where you try to install the package. if you are using use sudo command before your statements.
You can do this using the runas command with an administrator trust-level, or by right-clicking the program in the UI and choosing "run as administrator."
Thanks

Your Node setup looks incorrect. It's not an issue with Create React App—it seems like you can't run any global Node commands.
It looks like ~/.node_modules_global/bin is not in your PATH environment variable so it can't execute global commands. That's just how Bash works—it can't guess where the command lies, you need to tell it. I would assume Node installation should do this by default but it depends on how you installed Node.
So make sure that directory is in your PATH and try again. If you use Bash, add this to your .profile and then restart the Terminal:
export PATH=$HOME/.node_modules_global/bin:$PATH

Related

npx start, npx install npx init is not working

I have been working with react for years using NPX and yarn and I just got assign to built an app with react-native using react native-cli so i tried setting up my environment using the react native docs and some YouTube videos. But after following the instructions like downloading android studios and adding in my new environment variable, I'm getting an error every time i tired to run
"npx react-native init AwesomeProject" which gave me this error
[![npx react-native init result][1]][1]
I also tried npm install and i got this error on git bash and also on my commandline
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Dennis\Desktop\GitHub\LCRN01-travel-onboarding-app-master\LCRN01-travel-onboarding-app-master\node_modules\core-js
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
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\Dennis\AppData\Local\npm-cache\_logs\2021-11-13T05_50_35_592Z-debug.log```
and also npx react-native start is showing this error on git bash
```openssl config failed: error:02001003:system library:fopen:No such process
Command `start` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.```
I have tried running "npm cache clean --force"
but still nothing changed
I can't even run npx create-react-app anymore because i keep getting this error
npx creat-react-app test
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/creat-react-app - Not found
npm ERR! 404
npm ERR! 404 'creat-react-app#latest' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dennis\AppData\Local\npm-cache_logs\2021-11-13T06_05_46_068Z-debug.log
I'm currently using a windows 10 device
node -v 16.13.0
npm -v 8.1.3
[1]: https://i.stack.imgur.com/OTLYj.png
It's create-react-app.
Not totally sure but another issue could be that your Git bash isn't in your PATH.
Plus, npx start and npx install doesn't sound right, maybe you meant npm start and npm install.
On top of that, it seems you have node v11 and not node v16, maybe you have different versions of node, some in Windows' PATH and some only accessible from bash.
It could help to clean up and reinstall your node versions and Git bash, also check your environment variables for remnants of previous versions, and make sure to not confuse npm and npx.

react-scripts: command not found (npm start)

I've been using create-react-app without issues for some time, but recently, after running it, I cannot start the development server. After running npm start, I get the following error:
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! js-calculator#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the js-calculator#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Scripts appear to be in the correct location and correctly configured in the package.json file.
Also, npm start throws me the same error if I run it in other react-apps folders that used to work before.
I tried various suggestions I found here on stackoverflow:
installing create-react-app globally;
reinstalling dependencies (npm install);
reinstalling react scripts (npm install react-scripts --save);
updating node and npm;
but none of the above worked.
Any suggestions?
I've also a more detailed .log file, in case anyone wants to have a look at it.
After many tries and more reading of related issues here on SO, I found the cause. One of my react-app parent folders (five levels above) name was "example/example"; naming it to "example-example" solved the problem.

What is the meaning of this error (protobufjs#6.11.2 postinstall: `node scripts/postinstall`)?

Hi i was installing firebase on the ubuntu console with npm install --save firebase
and got this error below in the installation process,
I tried to install npm install protobufjs#6.11.2 to try to get rid of the error but it did not work.
What is the meaning of the error?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protobufjs#6.11.2 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protobufjs#6.11.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm attempts not to run the protobuff postinstall script as root and when you are trying to run it as a root using "sudo" command npm will try to prevent it. So you need to use --unsafe-perm flag while installing. So the full command will look like
sudo npm install --unsafe-perm -g firebase
I am not sure why this error occurs but my understanding is that it is related to some sort of permission issue.
You can solve this error by prefix Sudo
sudo npm install --save firebas

Cypress installation failed

I installed nodejs and npm on windows 10. Than I tried to install cypress via npm install cypress --save-dev and get the following Error:
> node index.js --exec install
The command "node" is either misspelled or
could not be found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress#3.8.2 postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress#3.8.2 postinstall 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\U\AppData\Roaming\npm-cache\_logs\2020-01-21T11_05_01_566Z-debug.log
After this I added the path %USERPROFILE%\AppData\Local\Temp to my system environment variables. But I get this error messages again. How can I fix this problem?
try the following steps :
install git on your machine and config it as global.
delete old package.js then re-init new package.
try again cypress install command
Try this instead by installing the previous version but Explicitly: npm install cypress#8.1.0 --save-dev
Download it in the any directory its a hack to download, if your proxy is properly configured and internet speed is good. it will download while doing npm install
wget https://cdn.cypress.io/desktop/7.6.0/win32-x64/cypress.zip
Provide the zip location
CYPRESS_INSTALL_BINARY=~/Downloads/cypress.zip npm install cypress
Remember to actually run the npm command inside your folder with the package.json.
Delete the package.json.
Again re build the package by npm init.
Install Cypress again by using npm install cypress --save-dev.

Cannot run "npm run watch", error message brings up "gulp" error

I am using a web starter kit from coding phase GitHub that normally works fine for me. for some reason when i attempt to run npm run watch it gives me error messages. I'm not 100% positive but I believe this begun when I updated my I did an uninstall and re-install of nodeJS. help me out!
sh: gulp: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! starter-kit-2019#1.1.0 watch: `gulp`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the starter-kit-2019#1.1.0 watch 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/joseperez/.npm/_logs/2018-12-20T02_45_19_840Z-
debug.log
Its because we are using 'gulp' as a global module. So when you removed node from your system, it removed the gulp which is a package installed.
You can reinstall it by using
`npm install gulp-cli -g`
And it will work!
Update:
He is using a mac so try running this command.
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli`
Hope this info turns out useful to someone after doing research on an error that was coming up on my console stating, "gulp: command not found" I found a link that addresses how to fix this. turns out my gulp was not installing properly because there was an issue with my path. btw I am using a Mac machine below is the link that helped me out!
here is the link that helped me out!

Resources