Unable to install npm packages on live server- throwing error - node.js

While running npm i on server after adding a package, it throws the error below.
While resolving: eslint-config-airbnb-base#13.1.0 npm ERR! Found: eslint#6.0.1
what could be the possible reason? I am a bit new in Nodejs.
I added package-lock.json in the code and tried to upload it and run the npm i command to install the packages, previously It wasnt throwing any such error.

Related

Error when atempting to create an Angular project

I have both NodeJS 18.13.0 , npm 8.19.3 and AngularCLI 15.1.1 installed. But whenever I go to start a project with "ng new project" I get an error:
Installing packages (npm)...npm ERR! code FETCH_ERROR npm ERR! errno
FETCH_ERROR npm ERR! invalid json response body at
https://registry.npmjs.org/parse5-html-rewriting-stream reason:
Invalid response body while trying to fetch
https://registry.npmjs.org/parse5-html-rewriting-stream: Socket
timeout
npm ERR! A complete log of this run can be found in: npm ERR!
/home/shize/.npm/_logs/2023-01-18T01_10_18_697Z-debug-0.log ✖ Package
install failed, see above. The Schematic workflow failed. See above.
I've tried uninstalling angular and reinstalling it. I've also tried clearing cache or "npm verify cache". And finally, also tried "npm config set registry https://registry.npmjs.org".
Also, if this info is of any help, along my struggle two different folders were created when attempting to run "ng new project-name". These folders had a lock sign on them and I deleted them both with "rm -r". I really don't know what to do, the error has changed when trying different things. Like one being about a bad network or proxy error. Another error I came along when probing around for a solution was this:
npm WARN deprecated #npmcli/move-file#2.0.1: This functionality has
been moved to #npmcli/fs
But for now the error is the first one, so I'll take it from there. I've been stuck for hours, any help would be much appreciated.

error npm ERR! code FETCH_ERROR npm ERR! errno FETCH_ERROR npm ERR! invalid json response body when installing reactjs

so im trying to learn ReactJS, but when i looked up to ReactJS docs, it says install with
npx create-react-app {project_name}
it also required nodejs & npm, i have installed node js latest version & npm. but when i run the command, it alwasy getting the same error, the error says
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/#types%2fsemver reason: Invalid response body while trying to fetch https://registry.npmjs.org/#types%2fsemver: EBUSY: resource busy or locked, rename 'C:\Users\AGUS\AppData\Local\npm-cache\_cacache\tmp\d5e89a99' -> 'C:\Users\AGUS\AppData\Local\npm-cache\_cacache\content-v2\sha512\5f\16\d22537befb8a38d3af73438bd2409a960900a502346287a0a0fa17784814bd2664f39eeb0107aa02ac292aeb51d7f52f4a90db5325d9b47bc8f5ce1538ca'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AGUS\AppData\Local\npm-cache\_logs\2022-11-02T08_20_55_473Z-debug-0.log
i have searched up this problem but its not solved, always error.
please help me solve this problem :(
i have tried uninstall & reinstall node, still not working,
i tried npm cache clean --force & npm cache verify still not working, thank you:)
Try :
npm cache verify
npx create-react-app {project_name}
I had the same error and these steps solved it.
√ Would you like to use src/ directory with this project? Yes
√ Would you like to use experimental app/ directory with this project? Yes
√ What import alias would you like configured? ... #/*
and also ensure that no background apps are running

Strapi with MongoDB (macOS): error while creating the project with the command "npx create-strapi-app my-project"?

I am trying to create a Strapi application with MongoDB and I am following the docs on the website, but when configuring the connection, I get this error and I am not understanding why.
Error I get everytime (screenshot)
Log's error (screenshot)
Error:
"Connection test failed: Command failed: npm install --prefix /var/folders/gb/519s_wwn1ps0c0skqw7_03140000gn/T/strapi40136a8b0f29 strapi-connector-mongoose#3.5.4
npm ERR! Cannot read property 'spec' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/red/.npm/_logs/2021-04-08T09_37_12_689Z-debug.log"
MongoDB was installed using Brew and is running as a service.
Node version is 14.16.1.
NPM version is 7.8.0.
Never had a problem like this before with any sort of package or similar.
I already tried to: uninstall MongoDB and reinstall it, reinstall Node and npm.
When I run npm install -g npm-reinstall I get this instead and I think it is related to the problem:
Error screenshot
What I need to fix this?
I fixed this issue by changing the registry of npm config.
npm config set registry https://registry.npmjs.org/
I had to downgrade npm to its previous version to avoid this error.
npm install -g npm#6

NPM install throws module not found error

I tried installing node modules by npm install
on a new repository but the following error is shown
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './git-host-info.js'
Perhaps bin or main points to a missing file in package.json?

npm ERR! errno -5

hi i am getting this error when I try typical starter command with react native
react-native init test
returns this error
npm WARN react-native#0.44.0 requires a peer of react#16.0.0-alpha.6 but none was installed.
Setting up new React Native app in /Users/xxxx/ReactNativeProjects/gpss
Installing React...
gpss#0.0.1 /Users/xxxxx/ReactNativeProjects/gpss
└── react#16.0.0-alpha.6
Installing Jest...
npm ERR! code EIO
npm ERR! errno -5
npm ERR! syscall read
npm ERR! EIO: i/o error, read
You could uninstall react-native and then use the following command:
npm install react#reactversion --save.
Note (reactversion) is your desired version you want to have.
You could also just try reinstalling it as:
npm install react --save
Or upgrade with:
npm update react-native
Eventually cleaning the cache worked out fine. Hope this answer solves any user's problem in the future.
I just had the same problem on Windows, using Virtual Studio Code. I uninstalled an unrelated program shortly before the error and I suspect that was the cause. So I restarted my PC and updated Windows and the npm errors were gone. Everything is working and disaster averted.
Try closing background tasks, updating and/or restarting your computer.

Resources