npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.49k stars 3.18k forks source link

[BUG] Missing required argument #1 #681

Closed HotGreenPeas closed 4 years ago

HotGreenPeas commented 4 years ago

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-debug.log

yk2kus commented 4 years ago

As people stated above looks like node v8.10.0 and npm v3.5.2 are no longer supported. I tried running npm install -g npm@latest but it didn't update my node and npm. If you're using Ubuntu 18.4 make sure you add the node 10 repository

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -       
apt -y install nodejs make gcc g++

Thanks!!!!!! Very good

Thanks worked for me!

marciabeatrizcp commented 4 years ago

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt -y install nodejs make gcc g++

Yes!! It's works!

brightchip commented 4 years ago

I had to upgrade my Ubuntu server from 18 to 20 to make it work

quenbyako commented 4 years ago

Holy crap, this issue still not closed??? After 10 months and 2 posts about fixing it??

No way.

@HotGreenPeas it's time to close. I can even make PR to edit docs with this problem fixing step by step.

ravicious commented 4 years ago

I had an old project which uses node 5.4.1. After installing it with nvm (nvm install 5.4.1), it installed some old version of npm (like 3.x). That version of npm couldn't handle npm i and failed with the same error as in the OP.

What I did was nvm install-latest-npm which installed the latest npm version that's compatible with node 5.4.1, which in this case is 5.3.0.

cheriecheung commented 3 years ago
  1. Update nodejs to latest version:
sudo npm install -g n
sudo n latest
  1. Update npm to latest version:
sudo npm install -g npm
  1. Do what @runcible suggested
hash -d npm
  1. Try npm install
npm i

I can also confirm the this works. In fact, the only solution that works for me. Thank you so much!

tarunjuneja commented 3 years ago

I won't simply move to latest! i was worries about node js compatibility as not all npm are compatible with all node versions

I have an older version of node installed on my machine i.e 5.x.x and I was on npm version 3.7.x

So i decided to move yo npm version 5.1.0 which is compatible

I simply did

npm install -g npm@5.1.0

Tip: after doing this git bash was still showing older version of npm and i was till getting same error. when i open cmd on windows machine it showed me the correct version installed!!

Fix: Reboot your machine, restarting bash won't help (at least to me it didn't)

Still to be figured out: I still can't understand what would have changed on NPM 3.7.x which is not under development and how my build process broke!!

ljharb commented 3 years ago

@tarunjuneja if you’re going to use older versions of node, I’d suggest using nvm, and nvm install-latest-npm which handles that problem.

cmidkiff87 commented 3 years ago

@tarunjuneja's solution works; however, if you're running inside a docker build, you're going to get an additional error:

npm ERR! EXDEV: cross-device link not permitted, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm.DELETE'

The solution (which I found from here) is to put this in your dockerfile

RUN \
  cd /usr/local/lib/ \

  && mv ./node_modules ./node_modules.tmp \
  && mv ./node_modules.tmp ./node_modules \

  && npm install -g npm@5.3

(v5.3 being the latest npm version that works with node5 < 5.10 according to nvm)

rendybiz commented 3 years ago

I have same issues like this in my ubuntu Server at 28 January 2021, Missing required argument #1 is npm issue.

after check my npm and nodejs version is very old. npm -v or node -v

so I'm using this method to re install my nodejs

and it fixed

Vi1234sh12 commented 3 years ago

Anyone, can you help me, how to resolve this error? Screenshot (570)

moha-wasefy commented 3 years ago

Hello, if you didnt solve it yet, follow this:

Update node js to latest version

1) sudo npm install -g n 2) sudo n latest 3) sudo npm install -g npm 4) hash -d npm 5) npm i

Source

demiansolano commented 3 years ago

This worked for me on Digital Ocean

david-mart commented 3 years ago

mos1em's solution worked, except i had to get rid of sudo's and hash command , i.e. npm install -g n n latest npm install -g npm npm i

jgv66 commented 3 years ago

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - apt -y install nodejs make gcc g++

Yes!! It's works!

works 4 me too !!!

neistow commented 3 years ago

Hello, if you didnt solve it yet, follow this:

Update node js to latest version

  1. sudo npm install -g n
  2. sudo n latest
  3. sudo npm install -g npm
  4. hash -d npm
  5. npm i

Source

worked for me on Digital Ocean. Thanks!

bibhuticoder commented 3 years ago
  1. Update nodejs to latest version:
sudo npm install -g n
sudo n latest
  1. Update npm to latest version:
sudo npm install -g npm
  1. Do what @runcible suggested
hash -d npm
  1. Try npm install
npm i

I can also confirm the this works. In fact, the only solution that works for me. Thank you so much!

Thanks For anyone still having issue. This one works 🚀🚀

prastutipriyodarshini commented 3 years ago
  1. Update nodejs to latest version:
sudo npm install -g n
sudo n latest
  1. Update npm to latest version:
sudo npm install -g npm
  1. Do what @runcible suggested
hash -d npm
  1. Try npm install
npm i

I can also confirm the this works. In fact, the only solution that works for me. Thank you so much!

This worked. Thank you so much!!!

liam-ot commented 3 years ago

@cheriecheung solution is what worked for me

RussQuan commented 3 years ago

ubuntu 18.04 vue cli installation

My solution works for me !

Install node.js 及 npm

sudo apt install nodejs
sudo apt install npm  

version check

nodejs --version
npm --version

upgrade Node.js to v13.x:

Install vue cli

sudo npm install --global vue-cli  

check vue cli

vue --version

if you need vue create hello-world, your node should be upper than v10

vue create hello-world
devtanna commented 3 years ago

Hello, if you didnt solve it yet, follow this: Update node js to latest version

  1. sudo npm install -g n
  2. sudo n latest
  3. sudo npm install -g npm
  4. hash -d npm
  5. npm i

Source

worked for me on Digital Ocean. Thanks!

This worked for me too on Windows 11 & WSL2. (I didn't run the hash command)

syo0e commented 3 years ago

Hello, if you didnt solve it yet, follow this:

Update node js to latest version

  1. sudo npm install -g n
  2. sudo n latest
  3. sudo npm install -g npm
  4. hash -d npm
  5. npm i

Source

i love you

raquelhortab commented 3 years ago

In case it helps someone, I was getting hash: Illegal option -d

I just removed the hash -d npm step from the solution and it worked

shivapendem commented 2 years ago

I got the same issue but i made if run perfectky by clearing the npm cauche, and then update and the npm to stable version and reinstall the values.

` sudo npm cache clean -f sudo npm install -g n sudo n stable

` then i installed using

pm2 install pm2-logrotate

BraxtonLowers commented 2 years ago

Updating and reinstalling the latest version of npm supported by the node version fixed this issue for me.

For anyone using nvm as their version manager on WSL 2, Ubuntu 18.04

sudo apt remove npm
nvm use <different node version>
nvm uninstall <your node version>
nvm install <your node version>
nvm install-latest-npm

I also likely had a conflicting installation of npm installed by the OS package manager instead of nvm, which may explain the benefit of running sudo apt remove npm in my case

xjcl commented 2 years ago

Just wanted to add that hash -d npm didn't work for me, maybe cos I use zsh. Try:

sudo npm install -g n
sudo n latest
sudo npm install -g npm
hash -r
npm i
spenelladm commented 2 years ago

I just ran into this, too.

rdeslonde commented 2 years ago

For those who can't update their node and npm versions very easily, I was able to get my build working by updating npm to the latest version of 3, which ended up being 3.10.10.

npm install -g npm@3

Or if you want to be specific: npm install -g npm@3.10.10

Hopefully this helps some of you!

Dude, thank you so much!

aatifkh8n commented 2 years ago

Someone please fix it. I've a project to deploy, waiting for it. Can anyone tell me how to ROLL IT BACK in Ubuntu Linux Distro?

Rey-17 commented 2 years ago

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - apt -y install nodejs make gcc g++

Yes!! It's works!

works 4 me too !!!

Me too !!!

wangminqi commented 1 year ago
  1. Update nodejs to latest version:
sudo npm install -g n
sudo n latest
  1. Update npm to latest version:
sudo npm install -g npm
  1. Do what @runcible suggested
hash -d npm
  1. Try npm install
npm i

Can confirm this works. Versions after this: Platform: Ubuntu 18.04LTS Node version: v14.5.0 npm version: 6.14.5

This one works (the only one perhaps) for me. I am using WSL2. So there are errors during these steps where "Getting GLIBC_2.28 not found" pop up, which can be retry and solved by

sudo apt-get remove nodejs nvm install 16.15.1

mitar commented 1 year ago

At least for Meteor versions:

1.3.4
1.3.4.1
1.3.4.2
1.3.4.3
1.3.4.4
1.3.5.1
1.4
1.4.0.1
1.4.1
1.4.1.1

I realized the problem was that I was installing meteor npm install --save @babel/runtime which are only needed for newer version of Meteor. Skipping that and the issue went away for me.

gmiller123456 commented 6 months ago

Had this issue, resolved it by deleting C:\Users\%USERNAME%\AppData\Roaming\npm* directories.

Tried many of the other suggestions, even a uninstall/reinstall of Node did not help.

MarioVilas commented 1 month ago

Same here. None of the solutions in this thread worked. I can only conclude npm is simply broken.