1
0

More than 1 year has passed since last update.

クローンしたリポジトリでnpm installを実行したらパスワードの入力を求められた話

Posted at

まず、フォークしたexpress-jwtリポジトリをローカルにクローンしました。

そしてVSCode Dev Containers拡張機能を使ってプロジェクトを開きました。

この時使ったDockerのイメージはmcr.microsoft.com/devcontainers/typescript-node:0-18-bullseyeです。

npm installを実行してみると、code E401エラーが発生しました。

node ➜ /workspaces/express-jwt (master) $ npm install
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR! 
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2023-02-18T09_22_56_224Z-debug-0.log

試しに、npm loginを実行してnpmにログインした状態でインストールを試みましたが、問題は解消されませんでした。

仕方がないので、Stack Overflowで調べたところ良さそうな回答が見つかりました。

このページの回答では、package-lock.jsonをまず削除してみろと書かれていたので、とりあえず削除してもう一度インストールを試みました。

node ➜ /workspaces/express-jwt (master) $ npm install

> express-jwt@8.4.1 prepare
> npm run build


> express-jwt@8.4.1 build
> rm -rf dist ; tsc


added 408 packages, and audited 409 packages in 39s

62 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

お分かりの通り、解決することができました。

もし同じようなエラーが出て困っている場合は、とりあえずpackage-lock.jsonを削除してみることをお勧めします。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0