Issue while executing " npm start" command - node.js

I am working on Frontend side Project. I create React_app and after that I run the 'npm start' command it returns an error. The error is as follows.
(hello) D:\NewPython\DockerDjangoReactProject\frontend\react_app>npm start
> react_app#0.1.0 start D:\NewPython\DockerDjangoReactProject\frontend\react_app
> react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react_app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react_app#0.1.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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-12-01T05_06_13_740Z-debug.log
please help me solve this problem, I want to complete my project but this error is in my way.

This issue is with react-scripts. Possibilities are
react-scripts is not installed. In this case, you can manually install using this command.
npm install react-scripts --save
Or if it is already there, then it might be the problem with node_modules folder. You can remove this folder and/or run the following command.
npm install

Related

Nestjs failed to deploy on cpanel

I'm trying to deploy my backend application on cpanel and I'm getting an error like this
what should i do to solve this problem?
> test3#0.0.1 start /home/nandaken/inventory
> nest start
stderr:
npm WARN lifecycle The node binary used for scripts is /home/nandaken/nodevenv/inventory/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: nest: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test3#0.0.1 start: `nest start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test3#0.0.1 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! /home/nandaken/.npm/_logs/2023-01-28T08_16_43_494Z-debug.log
Looks like cpanel is calling the startscript which is running nest start. More than likely, you only have production dependencies installed, so #nestjs/cli isn't installed because it is a devDependency. Either configure cpanel to call a different start script (like start:prod which should map to node dist/main) or change your start script to run the proper js file (like node dist/main). The other option would be to install #nestjs/cli as a production dependency, but I wouldn't suggest that

'REACT_APP_VERSION' is not recognized as an internal or external command, operable program or batch file

I am trying to run a react project in my Windows environment but It's throwing the following error. Before, this project worked on Ubuntu with the same things. It started to happen after I changed the OS. How can I fix this?
I am just running npm start command.
> REACT_APP_VERSION=$npm_package_version react-scripts -r #cypress/instrument-cra start
'REACT_APP_VERSION' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! PROJECT NAME start: `REACT_APP_VERSION=$npm_package_version react-scripts -r #cypress/instrument-cra start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the PROJECT NAME 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:
UPDATE
I just fixed it with the following package. It is about windows.
https://www.npmjs.com/package/cross-env
Thanks.

Error using Framework7 and service.js for hosting in the local host

when i clicked the npm run service. This error is what i am getting
I have used the same app in the following link:
https://github.com/valnub/f7-node-autocomplete-search-demo
framework7-react-app-template#3.0.0 service C:\Users\Tallam Tharun Sai\auto-complete
PORT=3001 nodemon service/service.js
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! framework7-react-app-template#3.0.0 service: `PORT=3001 nodemon service/service.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the framework7-react-app-template#3.0.0 service 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\Tallam Tharun Sai\AppData\Roaming\npm-cache\_logs\2020-07-10T18_16_54_175Z-debug.log
The answer for this is.
I have deleted the Package.json and Node modules from the project and again followed the steps to install the npm as (npm install).
Then I have the installed my npm app successfully.

npm ERR! code ELIFECYCLE errno 1 when npm install on a module

npm install
hi-activate-tenant#2.2.0 install
C:\Santhosh\DevCentre\node8\BI-GIT-MASTER\hi-activate-tenant
./install.js
'.' is not recognized as an internal or external command, operable
program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hi-activate-tenant#2.2.0 install: ./install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hi-activate-tenant#2.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
I have already tried almost all the solutions like
npm cache clean --force
removing node_modules
and again npm install
please help me !!!
Adding node in front of the script commands should work. So it should be like:
node ./install.js
Found the solution for the above issue :
'.' is not recognized as an internal or external command, operable program or batch file.
This error was due to the path failure.
In the package.json file for the install script it was given as './install.js
change it to '.\install.js' and the fix works fine.
run an npm install now and the install will be successful without ant errors.

I am having this ERR! code ELIFECYCLE error while running npm start locally?

I am newbie to React and trying to build my first React App. My App was running fine till last night. When I open my project in the morning and ran npm start or yarn start command, it gave me error - ERR! code ELIFECYCLE
I tried to close app and tried to run command again as per one of the solution given in the forum. But, that didn't work.
" *react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-portfolio#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-portfolio#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
"*
Thank you in advance!
You're missing the react-scripts package. You need to do an npm install.
If npm install doesn't fix your problem it's probably because npm install is not able to properly complete the installation. Try this instead:
Delete the node_modules folder and
delete the package-lock.json file or the yarn.lock file
Run npm install
Run npm i -S react-scripts
Run npm start
Good luck!

Resources