Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install eslint missing argument error

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.

like image 254
ashishshenoy Avatar asked Jan 12 '20 05:01

ashishshenoy


People also ask

How do I install ESLint locally?

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.

How do I use ESLint in node JS?

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.


2 Answers

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

like image 53
Mickael B. Avatar answered Sep 20 '22 15:09

Mickael B.


I have tried above but it, unfortunately, didn't work for me. The other way could be this:

  1. Update nodejs to latest version:

    sudo npm install -g n
    sudo n latest
    
  2. Update npm to latest version:

    sudo npm install -g npm
    
  3. Do what @runcible suggested:

    hash -d npm
    
  4. Try npm install:

    npm i
    
like image 39
Otabek Butcher Avatar answered Sep 22 '22 15:09

Otabek Butcher