Can't install ESLint in project folder - npm error code ENOSELF - npm

I'm struggling to install ESLint from my terminal (locally in my project folder).
I'm running this command:
sudo npm install eslint --save-dev
However, an npm error with code ENOSELF is returned, with the following message
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "eslint" under a package
npm ERR! also called "eslint". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/[username]/.npm/_logs/2020-01-07T14_32_27_111Z-debug.log
I have no folder nor files named eslint or anything remotely close to that. In my project directory I have a collection of html, js and csv files that have been edited with VSCode.
I'm really confused why this error is happening, and would appreciate help.

Make sure that the name property in your package.json is not eslint

Related

How can I solve an error while using npm install?

I just wanna install dependencies for my project after cleaning "node_module" folder and deleting package-lock.json file:
npm install
And always get an error:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^" of package "eslint-plugin-react#^": Tags may not have
any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Local\npm-cache\_logs\2023-01-31T16_45_46_763Z-
debug-0.log
and the same error when using yarn.

NPM Error code when trying to run npm start

I keep getting the npm ENOENT error when I try to run npm start. I'm not sure what to do to fix this issue.
I have tried to change permissions for folders.
bryantcaruthers-> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/bryantcaruthers/workshop-vs-code-can-do-that/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/bryantcaruthers/workshop-vs-code-can-do-that/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/bryantcaruthers/.npm/_logs/2019-11-06T03_31_38_233Z-debug.log
Be able to run npm start with no errors.
The error is that there is no package.json file in the directory you are running the code in:
no such file or directory, open /Users/bryantcaruthers/workshop-vs-code-can-do-that/package.json
Are you expecting a package.json file in that directory? Or should you be running npm start from somewhere else?
You can resolve that issue by following methods:
Ensure dependencies described correctly on package.json
Just run
npm install
Check issue still exists. and If issue not resolved, continue these methods.
npm cache clean
sudo npm install -g npm
npm cache clean
npm install
I found solution to this error. This error mostly occurs because you are not working on the right folder, cd to the right folder where you installed the npm or you can open the folder with vs code. For example, you have a main folder that contains the site or app folder, you need to be working from the subfolder and not the main folder, this is where you installed the npm and the dependencies are described correctly on package.json.
Your project workshop-vs-code-can-do-that does not have a packeage.json file available, to create it, go to terminal (on your project path), run this command
npm init -y
Encountered the same error.
Root Cause:
Not installing(npm i) and starting(npm start) from the correct path in terminal
Solution:
Change the directory to the application directory where package.json
present
hope this might help, Thanks.

Private modules npm install error

After npm install in project local directory I've got log with error like this
npm ERR! code ENOLOCAL
npm ERR! Could not install from "..{path}" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/home/.npm/_logs/2018-06-28T11_13_56_437Z-debug.log
How I can resolve this problem? (the best way without deleting node-modules)

After running command "npm i" I started getting multiple error

I am facing this issue after I ran npm i command by following THIS THREAD. Now when I am trying to install various dependency for my project, I am getting bunch of errors:
λ npm install -g
npm WARN
D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash
is not a child of C:\Users\xxxxx\AppData\Roaming\npm
npm ERR! path
D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename
'D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash'
-> 'D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules.lodash.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\xxxxx\AppData\Roaming\npm-cache_logs\2017-07-26T12_26_10_273Z-debug.log
This is a common issue in the new version of npm. It has been brought to their attention. I believe you can fix the issue by creating a new root directory for your project and paste everything but your node_modules folder in it. Then try npm install
your path might be incorrect...
go to your directory and press right click with shift and select command prompt then execute your command...
I faced the same issue with npm. In my situation I had the project folder on Github. Please delete the local copy of the project folder entirely. Clone the project again to local and run the npm i command inside the project directory.
I am assuming you are trying to install the packages installed in dependencies mentioned in package.json.
I used VSCode in administrator mode,
have windows 10 :build 19041.508 and
Using WSL 2.0.

Atom editor Package installation error

I got an error when i install packages in Atom
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\\Users\\Jarvis\\AppData\\Local\\atom\\app-1.5.3\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\Jarvis\\AppData\\Local\\atom\\app-1.5.3\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\Jarvis\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\Jarvis\\.atom\\.apmrc" "install" "C:\\Users\\Jarvis\\AppData\\Local\\Temp\\d-116128-3752-1lwywgv\\package.tgz" "--target=0.34.5" "--arch=ia32"
npm ERR! node v0.10.40
npm ERR! npm v2.13.3
npm ERR! file C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
I am trying to install lots of packages in atom Editor but i got above error.
If you open the C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json with Notpad++ ( or any other editor your choice - just don't do it in atom, it will crash, at least in Version 1.6.2 it did for me ) and look for the non printable characters. You will see that the file contain a lot of NUL. I had the same error suddenly one day, when trying to install updates for my packages.
Here is what i did to resolve the error. Be warned however that you have to install all packages again. Personally i use sync-settings (which backups my packages etc.), so it was no big deal for me.
Delete the entire C:\Users\Jarvis.atom\packages folder
Delete the entier C:\Users\Jarvis.atom.apm folder
Reinstall all packages (.apm folders will then installed automatically)
It can be hard to delete those folders because of the Path too long restriction. In this case there helps a Stackexchange answer: How to delete a file in Windows with a too long filename?