Atom editor Package installation error - npm

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?

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.

unable to npm link a directory

I'm trying to npm link to a directory inside another project's node modules (as per this issue and workaround https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react where otherwise stuff doesn't work because a library I'm including also has a react)
What seems to be happening is even though I specify that the path has to have node_modules in side of it (see the first line for the input: sudo npm link ../../EicherDesignBuild/contractor-order-app/node_modules/react), somehow, npm link internally takes that part out (no such file or directory, open '/home/user/Documents/Dev/EicherDesignBuild/contractor-order-app/react/package.json')
(I have to do it with sudo, otherwise I'm getting a permissions error)
[user#work contractor-order-app]$ sudo npm link ../../EicherDesignBuild/contractor-order-app/node_modules/react
npm WARN tarball tarball data for react#file:react (null) seems to be corrupted. Trying again.
npm WARN tarball tarball data for react#file:react (null) seems to be corrupted. Trying again.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/user/Documents/Dev/EicherDesignBuild/contractor-order-app/react/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/user/Documents/Dev/EicherDesignBuild/contractor-order-app/react/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! /root/.npm/_logs/2022-07-16T19_24_44_703Z-debug-0.log
What is happening and why? How can I link this library?
npm version: 8.11.0
node version: v14.19.0

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

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

npm install package.js - can I revert to earlier package?

I am following this tutorial on vue.js on YouTube. One of the packages I installed was eslint 5.5 (which is the current version). I saw this error message:
npm ERR! Failed at the server#1.0.0 lint script 'eslint **/*.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint **/*.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/jason/Documents/vue-movie/server/npm-debug.log
I tried updating Node and NPM, but that did not change this failure. The tutorial is using "^4.6" and I was wondering if there is a way to revert the package I have to an earlier version? And how would I do that?

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)