LoginSignup
0
0

More than 3 years have passed since last update.

gh-pagesでnpm run deployすると「fatal: could not read Username for 'https://github.com': Invalid argument」というエラーが出る

Last updated at Posted at 2020-06-20

あらすじ

skytomo221.github.io にGatsbyでポートフォリオを作ろうと思って、
ここのサイトを参考に、gh-pagesを使ってnpm run deployしようとしたところ、「fatal: could not read Username for 'https://github.com': Invalid argument」というエラーが出た。

どんな感じでエラーが出たか

$ npm run deploy

> cara@0.1.7 deploy D:\skytomo\skytomo221.github.io
> gatsby build && gh-pages -d public -b master

success open and validate gatsby-configs - 0.160s
success load plugins - 1.500s
...(省略)...
Generated public/sw.js, which will precache 9 files, totaling 317400 bytes.
success onPostBuild - 0.554s
info Done building in 31.231 sec
Fatal: HttpRequestException encountered.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cara@0.1.7 deploy: `gatsby build && gh-pages -d public -b master`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cara@0.1.7 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
...(以下略)

色なしだと分かりにくいかもなので画像バージョンも

image.png

対処法

GitHub PagesにReactアプリをデプロイする方法に書かれていた解決方法

$ rm -rf node_modules
$ npm install
$ npm run deploy

上記の方法で解決できない場合、さらに、

git config --global credential.helper wincred

をしてみましょう。
fatal: could not read Username for 'https://github.com': No error #230に書かれていた方法です。
私はこれで解決しました。

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