Am trying to install eslint locally in a project folder. However installing as mentioned on https://eslint.org
npm install eslint --save-dev
returns the following error:
npm ERR! Linux 4.15.0-70-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "eslint" "--save-dev"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/ashish/Documents/Web-Development/Bootcamp/auth-test/npm-debug.log
I have tried installing eslint globally, and also without saving the dependency to package.json but the same error message appears.
npm doesn't return an error for any other package (express, request etc.). This seems to be happening only with eslint.
If you haven't installed ESLint either locally or globally do so by running npm install eslint in the workspace folder for a local install or npm install -g eslint for a global install. On new folders you might also need to create a . eslintrc configuration file.
While ESLint is designed to be run on the command line, it's possible to use ESLint programmatically through the Node. js API. The purpose of the Node. js API is to allow plugin and tool authors to use the ESLint functionality directly, without going through the command line interface.
Your npm version is too old (4 years old), you need to update it
npm i -g npm
Also consider updating node
, version 8 is End-of-life
since 31 Decembre 2019.
https://github.com/nodejs/Release
I have tried above but it, unfortunately, didn't work for me. The other way could be this:
Update nodejs to latest version:
sudo npm install -g n
sudo n latest
Update npm to latest version:
sudo npm install -g npm
Do what @runcible suggested:
hash -d npm
Try npm install:
npm i
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With