NPM start failing - reactjs

I'm trying to run my back-end code on the local host. It was functioning perfectly until I added a video into the folder and ran a python program which used the video to output results which should be displayed on the localhost.
Before I ran the python program I installed opencv, python 3 and pip3.
All my other team members have the exact same structure and code and it is working perfectly for them.
After all this, I'm getting is this error:
C:\Third_Year\IBM_project\ibm\back_end>npm start
back-end#0.0.0 start C:\Third_Year\IBM_project\ibm\back_end
node ./bin/www
undefined:1
[{'frame_number': 1, 'roi0': [101.78202823559488, 99.39509279584912, 49.546951219239915, 29.728170731543948], 'intensity0': 80.0, 'roi1': [101.78202823559488, 99.39509279584912, 49.546951219239915, 29.728170731543948], 'intensity1': 157.0},
^
SyntaxError: Unexpected token ' in JSON at position 2
at JSON.parse (<anonymous>)
at C:\Third_Year\IBM_project\ibm\back_end\routes\IntensityAPI.js:31:19
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! back-end#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the back-end#0.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! C:\Users\holly\AppData\Roaming\npm-cache\_logs\2020-03-16T11_03_34_055Z-debug.log
C:\Third_Year\IBM_project\ibm\back_end>
I've tried
Running; npm cache clean --force
Deleting node_modules folder and package-lock.json file by running:
rm -rf node_modules package-lock.json
Or deleting it manually by going into the directory and right-click > delete / move to trash.
Running; npm install then to start again run; npm start
However this did not fix my problem, any other suggestions?

Related

ASP.NET CORE with REACT.js npm run build code 1

When the project is trying to be deployed, I get the following Error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! s2cweb_react#0.1.0 build: react-scripts --expose-gc --max-old-space-size=8192 build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s2cweb_react#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! /home/runner/.npm/_logs/2021-09-08T13_45_58_680Z-debug.log
/home/runner/work/MyProject/MyProjectApp/MyProjectApp.csproj(36,5): error MSB3073: The command "npm run build --prod" exited with code 1.
Error: Process completed with exit code 1.
I tried to change package.json as well as MyProjectApp.csproj but no luck. I Also tried without --prod but the same error persists. Please help me.

Can't run npm in visual stuido terminal

I am install react & angular on the system. but when I write npm start in visual studio code. it shows an error.
if anyone knows how to fix this problem please tell me. it's very helpful for me. I am trying to fix this error last 4 hours
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Pooja Patel\AppData\Local\npm-cache\_logs\2021-09-07T14_31_21_583Z-debug.log
PS C:\Users\Pooja Patel\Desktop\evalue webpage> npm run
Lifecycle scripts included in ionicstore#1.0.0:
test
echo "Error: no test specified" && exit 1
PS C:\Users\Pooja Patel\Desktop\evalue webpage> npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
PS C:\Users\Pooja Patel\Desktop\evalue webpage> npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Pooja Patel\AppData\Local\npm-cache\_logs\2021-09-07T15_54_08_904Z-debug.log
PS C:\Users\Pooja Patel\Desktop\evalue webpage>
Your package.json file doesnt have scripts, so when you run npm run start, npm cant find the start script in it.
So, open and edit your package.json file and write a script in order to run it.
I had a similar problem. In my case, I had to go to the folder itself in which the project is located. As I understand it, in the C:\Users\Pooja Patel\Desktop\evalue webpage> folder you still have a folder in which the project is located. Just go into it and even then write npm start.

npm run deploy error unable to publish on github pages

I've had my personal website made with React published on Github pages for about a year now and I would always update it using the following commands:
git add .
git commit -m "update"
npm run deploy
git push -u origin main
The last time I was able to run these commands without fail was last week. Since then, the only changes I've done to the repo are changing the repo name on Github but now I'm unable to run the same commands without receiving a 403 error. In the end I decided to start a new repo but now I get the following error:
fatal: A branch named 'gh-pages' already exists.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! username.github.io#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the username.github.io#0.1.0 deploy 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/computer/.npm/_logs/2021-08-17T22_31_00_085Z-debug.log
I've also tried manually removing gh-pages from node_modules/.cache but instead I get this error:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/username/username.github.io.git/': The requested URL returned error: 403
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! username.github.io#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the username.github.io#0.1.0 deploy 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/username/.npm/_logs/2021-08-17T22_41_14_919Z-debug.log
Is there anything else I can do besides give up?
*** note: I replaced my actual gh username for privacy

code ELIFECYCLE when trying to run npm install

I have been recently asked to add some features to a new project but suddenly I 'm facing this issue when trying to run npm install
C:\Users\NUMBER 1\Desktop\Galacticode>npm install
> codeHome#1.0.0 postinstall C:\Users\NUMBER 1\Desktop\Galacticode
> touch secrets.js
Touching secrets.js
> codeHome#1.0.0 prepare C:\Users\NUMBER 1\Desktop\Galacticode
> if [ -d .git ]; then npm-merge-driver install; fi
-d was unexpected at this time.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! codeHome#1.0.0 prepare: `if [ -d .git ]; then npm-merge-driver install; fi`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the codeHome#1.0.0 prepare 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\NUMBER 1\AppData\Roaming\npm-cache\_logs\2019-11-26T15_32_13_499Z-debug.log
Try to check you path variable, in this case, it should be C:\Windows\System32, If not, you can reference the answer of Saket, If still not work for you, only one way is that you need UNINSTALL current version and re-install again, it will fix.
You can solve this using below steps-
step 1: Run $ npm cache clean --force
step 2: Delete node_modules folder and package.lock.json
step 3: Run npm install
These could solve the issue !
Reference : https://stackoverflow.com/a/49505612/11781891

Installing create-react-app gives npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'

Errors when i use sudo npm install create-react-app -g
npm ERR! Linux 4.13.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "create-react-app" "-g"
npm ERR! node v6.11.4
npm ERR! npm v3.5.2
npm ERR! shasum check failed for /tmp/npm-16477-77596b49/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! Expected: 8e4d2a256c0e2185c6b18ad694aec968b83cb1d1
npm ERR! Actual: 5eb06eb521673d0940a4deb11baf89d62647f193
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
when use npm install create-react-app
- npm-version : 6.0.0
- node-version: 8.11.1
error is:
npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dilipcoder/.npm/_logs/2018-05-05T11_34_14_721Z-debug.log
i have already tried these options
npm cache clean --force
reinstalling npm and node
switching different version of npm
error which I get while installing create-react-app other packages installed properly
the error npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near'....' , will be solved by switching npm reigistry from the list of given npm registry.
List of Npm registry:
https://registry.npmjs.org/ (Dfault One)
http://r.cnpmjs.org/
https://registry.npm.taobao.org/
https://registry.nodejitsu.com/
http://registry.mirror.cqupt.edu.cn
https://skimdb.npmjs.com/registry
https://npm.open-registry.dev/ (https://open-registry.dev)
To switch just type
npm config set registry "https://registry.npmjs.com/"
Replace the registry url with the above urls check which one works for you.
After That:
npm cache clear --force
npm cache verify
now error will be solved.
"npm cache clean --force" didn't work for me but removing package-lock.json worked.
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-395750082
Error:
SyntaxError: Unexpected end of JSON input while parsing near
Removing package-lock.json worked for me.
Add Powershell script or Linux script as below,
Powershell:
Remove-Item package-lock.json -Force
Linux:
rm -rf package-lock.json
Path In Azure Devops:
$(System.DefaultWorkingDirectory)\appName\appName\ClientApp\node_modules'
Note - appName is an example you can add a path as per your source code.

Resources