npm ERR! Cannot read property 'version' of null - javascript

I can't install anything in it, tried solutions in here but did not work any either.
$ npm install axios
npm ERR! Cannot read property '**version**' of null
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\\AppData\Local\npm-cache\_logs\2021-08-26T13_54_26_790Z-debug.log

Try to cleanup node cache and remove node_modules:
$ npm cache clean --force
$ rm -rf node_modules
After try to run npm install axios.

this error generally came when you used any deprecated library on your project. so just go through your package.json file and remove those deprecated library which you have been used...
simply remove that versions from package.json and do
npm i --legacy-peer-deps
if it will not resolved then try run this
npm install axios --legacy-peer-deps

can you please check your
npmlockversion in the package-lock.json ,
and you npm version?
if you are using npmlockversion 3 you should use npm version higher than 7.

Related

how to fix npm audit error with loadVirtual and ENOLOCK?

➜ npm audit
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
I ran npm audit and got this error.
When I run below:
➜ npm config get package-lock
true
➜ npm config get shrinkwrap
true
Can anybody help with this? as to how to fix it? and npm audit fix --force is not working as well...
I just ran the command it says to.
npm i --package-lock-only
Then it showed me 0 vulnerabilities.
Anyway, ran again audit fix and again 0 vulnerabilities.
works for me like this:
npm cache clean --force
npm fund
npm audit fix --force
The problem is that you need a package.json and package-lock.json file in the directory.
Running the following commands will fix it for you.
npm init -y
npm i --package-lock-only
npm audit
This fixes the problem
That error tells you the root of the problem: This command requires an existing lockfile.. This implies that you don't already have a package-lock.json along side the package.json you're trying to audit. npm i --package-lock-only just generates/updates package-lock.json without reinstalling; npm i would reinstall and generate one (based on your config).
You need to create package-lock.json, run
npm install
then
npm audit fix
you won't have the problem
I updated to the latest version of npm with npm install -g npm#8.3.0, and now it shows no more problems...
Try running these:
npm i --package-lock-only
npm config get package-lock
npm config get shrinkwrap
npm i --package-lock-only
npm audit fix
From here.
Use Node 14, it fixed the issue with 0 vulnerabilities.
I read this and really helpful:
https://medium.com/illumination/how-to-fix-npm-audit-error-with-loadvirtual-and-enolock-deprecated-dependencies-1f07ba65eef9
npm i --package-lock-only
npm config get package-lock
npm config get shrinkwrap
npm i --package-lock-only
npm audit fix
(When running ‘npm config get package-lock’ and ‘npm config get shrinkwrap’, you will receive ‘true’ for both)
— → After running ‘npm audit fix’, you will see: “up to date, audited… found 0 vulnerabilities”
Had the same error, then realized I was in a parent folder. So this may happen if there's no lock file.
Try running this command:
npm cache clean --force

vue cli not installing , tried using yarn and npm none is working?

i have been trying to install vue cli
am getting this error :
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! Unexpected end of JSON input while parsing near '...b\n/0ygjrhbcRx2VetexZ'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ekikere\AppData\Roaming\npm-cache_logs\2020-07-28T23_29_37_356Z-debug.log
This is a problem related to npm. You can get this error when the cache file gets corrupted. Clearing the cache solves the problem. Can you try this?
npm cache clean --force
you can clear cache by running these command :
npm cache clean --force
linux system:
run command as root
sudo npm install -g #vue/cli
windows system
open command prompt as adminstrator then run :
npm install -g #vue/cli

Error : create-react-app Aborting installation

according to Reactjs docs :
You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine. To create a project, run:
npx create-react-app my-app
which my env meet it:
AymanMorsy#DESKTOP-6V4567D MINGW64 /g/reactprojects
$ node --version && npm --version 👈👈
v12.16.0 👈👈
6.13.4 👈👈
AymanMorsy#DESKTOP-6V4567D MINGW64 /g/reactprojects
$ npx create-react-app my-app
npx: installed 99 in 17.908s
Creating a new React app in G:\reactprojects\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz
npm ERR! 404
npm ERR! 404 'error-ex#^1.3.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'parse-json'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AymanMorsy\AppData\Roaming\npm-cache\_logs\2020-02-12T21_29_30_123Z-debug.log
Aborting installation. 🚨🚨🚨
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting my-app/ from G:\reactprojects
Done.
I tried solutions on Create React App not installing, showing an error and aborting installation
finally I formated C and installed latest update of windows10 and still see the same problem
edite: output of npm config list
$ npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.13.4 node/v12.16.0 win32 x64"
; builtin config undefined
prefix = "C:\\Users\\AymanMorsy\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = G:\reactprojects
; HOME = C:\Users\AymanMorsy
; "npm config ls -l" to show all defaults.
Looks like https://registry.npmjs.org/error-ex is down for some regions
It will be soon up
solution for this following ⤵
Install Scoop
and then install
yarn and then do yarn create-react-app myapp100% work definitely
In my case, antivirus was stopping some of the modules from being accesses. Turned it off, also installed yarn. Works fine
Stop Antivirus momentarily.
npm install -g yarn
yarn global add create-react-app
npx create-react-app my-app
Start Antivirus
Although I feel that yarn is not mandatory to solve this issue in my case - I prefer yarn.
Hoping this helps someone out there.

npm Error! ENOENT: no such file or directory .dezalgo.DELETE'

Whenever I try to do anything with my NPM I keep on getting this error.
I try to install npm install -g --save vue-draggable
I have uninstalled node and npm and re installed and constantly having this issue.
npm ERR! path /Users/victor/Desktop/myprog/node_modules/jquery/node_modules/npm/node_modules/dezalgo
NPM Verson: 5.6.0
Node: v8.9.1
To anyone having this problem, its because NPM is version 5.6.0
Downgrade to:
Sudo npm install -g npm#4.6.1
I don't think that the accepted solution will solve the issue...
Somehow a dependancy representation in package-lock.json is wrongly described.
Removing the file package-lock.json and npm install could solve the issue.
I recommend that you use the latest version of npm : npm install npm#lastest.

NPM not working (Cannot find module 'internal/fs' - nodejs)

NPM error on update. I recently update to Node version 7.x. Now npm is not working.
I am unable to locate the error, it may be due to -
npm ERR! Cannot find module 'internal/fs'.
I get the following when I run sudo npm update -g -
npm ERR! Linux 3.13.0-101-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" "-g"
npm ERR! node v7.1.0
npm ERR! npm v3.10.8
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
My /etc/profile.d/nodejs.sh has the following contents:
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export NODE_PATH
You should be able to remove the npm directory (typically /usr/local/lib/node_modules/npm) and then reinstall one of the official node tarballs, which includes npm (you can find the latest from http://nodejs.org/dist/latest-v7.x/).
Did you upgrade from an older version of node?
If so, that is probably part of the reason why you are having this issue. Older versions of graceful-fs (a dependency of npm) did things that are no longer available in node v7.
According to this thread, updating npm to version 4 will solve your problem, try:
npm i -g npm#4
If this doesn't work, try:
~/.n/n/versions/node/7.0.0/bin/npm i -g npm#4
delete node_modules directory and then type in your console "npm install". For a reason that I dont know, if you only update npm, it does not fix the error, but re-installing npm everything is gonna be allright.
For me, if I facing error "cannot find module internal/fs", it would be refer to command path. Better find the command path:
npm config get prefix
put into system environment path.
It is worked for me after facing the error several days.

Categories