npm install throwing errors - node.js

The code throws the same error when npm install or npm install --save is called.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/andyc/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/andyc/package.json'
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! /Users/andyc/.npm/_logs/2021-11-04T02_19_18_554Z-debug.log
any idea why this is happening?

It seems you don't have package.json. So, you need to follow these steps, for every new project
Step: 1
npm init --yes
Step: 2
npm i --save 'packagename'
Step: 3 - When you delete and re-install packages by deleting node_modules, run this:
npm i/install

Related

Trouble with installing Nodemon on Windows machine

I have been running into some issues while trying to install nodemon globally.
here's what it looks like:
$ npm i -g nodemon
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\krishnna sarrdah\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\krishnna sarrdah\AppData\Roaming\npm'
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\krishnna sarrdah\AppData\Local\npm-cache\_logs\2021-01-22T16_04_35_377Z-debug.log
Your node installation is slightly out of date, I solved this problem with this
repair Node installation
npm update -g

can't install node express on windows 10

I am trying to set up a node express development environment on windows 10. I have successfully installed node.js and npm but when I try to install express using:
npm init
npm install express
I get the following error:
npm WARN myapp#1.0.0 No description
npm WARN myapp#1.0.0 No repository field.
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Users\mi292519\Dropbox\selfLearning\nodeJs\myapp\node_modules\bytes
npm ERR! dest C:\Users\mi292519\Dropbox\selfLearning\nodeJs\myapp\node_modules\.bytes.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\mi292519\Dropbox\selfLearning\nodeJs\myapp\node_modules\bytes' -> 'C:\Users\mi292519\Dropbox\selfLearning\nodeJs\myapp\node_modules\.bytes.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\mi292519\AppData\Roaming\npm-cache\_logs\2020-10-07T11_17_07_099Z-debug.log
I tried removing node_modules and package.json also tried deleting npm-cache and npm install again but none of that worked
any help would be appreciated
Thanks!

How do I install npm dependencies from package-lock.json only?

I've run commands like npm install js-yaml and now that has generated a package-lock.json file.
How can I then use this file to reinstall the dependencies?
chris#instance-1:~/fuck3$ npm ci
npm ERR! path /home/chris/fuck3/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/chris/fuck3/package.json'
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! /home/chris/.npm/_logs/2019-07-11T17_31_26_335Z-debug.log
chris#instance-1:~/fuck3$ ls
index.js job.yaml package-lock.json

How to fix npm start errors

I just downloaded a dashboard that uses react.js modules so when get to the dashboards source folder and try to run the command 'npm start' I get the error below:
I tried the following commands but it couldn't work
sudo npm -g uninstall node
npm install node
npm cache clean
sudo npm install -g npm
npm install
npm start
npm ERR! path /home/lamechd/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/lamechd/package.json'
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! /home/lamechd/.npm/_logs/2019-06-04T09_51_23_106Z-debug.log
NB/ Iam using manjaro Operating System based on archlinux

Child module is unable to install dependencies (global install) - Relative path issue?

I have an npm package with a structure like this:
./
./backend
./package.json
package.json
So basically two npm modules in the same folder, one being a child of the other, file structure wise.
The way I install is, is that I put a post-install script in the parent package.json:
"postinstall": "cd backend && npm install && cd .."
What happens ONLY if I install it globally: It first prints some warnings that basically the packages weren't installed. Like this:
npm WARN enoent ENOENT: no such file or directory, open '/usr/lib/node_modules/inschpektor/backend/node_modules/trim-newlines/package.json'
Those appear for all dependencies in ./backend/package.json.
I already run the installation with the --unsafe-perm flag:
npm install -g inschpektor --unsafe-perm which installs the parent package.json, that contains the postinstall script.
The final log error message I get is this one:
npm ERR! path /usr/lib/node_modules/inschpektor/backend/node_modules/ansi-regex/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/usr/lib/node_modules/inschpektor/backend/node_modules/ansi-regex/package.json'
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! /home/codepleb/.npm/_logs/2019-01-02T01_52_46_911Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 254
npm ERR! inschpektor#0.9.1 postinstall: `cd backend && npm install && cd ..`
npm ERR! Exit status 254
npm ERR!
npm ERR! Failed at the inschpektor#0.9.1 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! /home/codepleb/.npm/_logs/2019-01-02T01_52_47_511Z-debug.log
What am I doing wrong? Or do you maybe see flaws in the way I'm setting things up?
Here is the link to get git repo, if you would like to further analyze it: https://github.com/codepleb/inschpektor

Resources