7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

npmにパッケージを公開しようとすると404エラーが出るときの対処法

Last updated at Posted at 2020-07-20

タイトル通り、npmにパッケージを公開(npm publish)しようとするときに404エラーが出た。日本語の情報が無く、原因を探すのに右往左往したのでメモしておく。

##筆者の環境
Windows 10 Home 1909
Node v12.18.2
npm 6.14.5

##状況

以下パッケージ名などは伏せてある。

$ npm publish ./
npm notice 
npm notice package: <name>@<version>
npm notice === Tarball Contents === 
npm notice <filesize>kB LICENSE
省略(ファイル色々)
npm notice <filesize>kB README.md
npm notice === Tarball Details ===
npm notice name:          <name>
npm notice version:       <version>
npm notice package size:  <package-size>
npm notice unpacked size: <unpacked-size>
npm notice shasum:        <shasum>
npm notice integrity:     <integrity>
npm notice total files:   <total-files>
npm notice
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/<name> - Not found        
npm ERR! 404 
npm ERR! 404  '<name>@<version>' 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
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!     <directory of logfile>

##解決法
npm adduserでログインするだけ

$ npm adduser
Username: <username>
Password: <password>
Email: (this IS public) <email-adress>
Enter one-time password from your authenticator app: <2FA Code>
Logged in as <usename> on https://registry.npmjs.org/.

##まとめ
チュートリアル記事は飛ばさずに読みましょう。

7
3
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
7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?