1
1

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 5 years have passed since last update.

`npm publish` するとエラー4048になる

Posted at

npm publish するとエラー4048になる

npm パッケージをリリースしようと思って、 npm publish をしたところ、以下のようなエラーが表示されました。

$ npm publish
npm ERR! path hogehoge\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'hogehoge\package.tgz'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'hogehoge\package.tgz']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'hogehoge\package.tgz'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'hogehoge\\package.tgz' },
npm ERR!   isOperational: true,
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'hogehoge\\package.tgz' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm のバージョンを最新にしてみましたが、効果はなさそうです。

原因はログインしていないから

原因を調査したところ、以下のサイトに行きつきました。
https://stackoverflow.com/questions/48964247/nexus-npm-publish-failed-with-error-4048

どうやらnpmへのログインが必要のようです。
当然ですよねw すっかり忘れていました。

以下のコマンドでログインします。

$ npm login
Username: 
Password:
Email: (this IS public) 

必要な情報を入力すれば、ログインができます
ログイン後に、 npm publish をしたところ、無事に成功しました。

さいごに

普段あまりしない作業というのは、手順をすぐに忘れてしまうので、将来の自分のためにも、こうやって記事に残すようにします。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?