teratailで質問しようと記事を書いてたら実行できたのでそのままこっちに載せます。。。
こちらの記事に関して何かご意見、ここはこうすればよかったんじゃないかなどいただければ幸いです。
firebase CLIを更新すべく
$ npm install -g firebase-tools
を実行すると、下記のようにエラーが出ます
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/firebase-tools failed, reason: getaddrinfo ENOTFOUND proxy.example.com proxy.example.com:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/●●●/.npm/_logs/2019-11-25T10_43_59_502Z-debug.log
$ npm config set proxy http://usr:pwd@proxyname:port
$ npm config set https-proxy http://usr:pwd@proxyname:port
$ npm config set registry http://registry.npmjs.org/
$ npm install -g firebase-tools npm ERR! Unexpected token < in JSON at position 0 while parsing near '<html>
npm ERR! <head>
npm ERR! ...'
npm ERR! A complete log of this run can be found in:
試したこと1
でたエラーをググって、
(「request to https://registry.npmjs.org/firebase-tools failed, reason: Client network socket disconnected before secure TLS connection was established」ここを検索して)
このサイトがでたので
上から
この部分まで実行しましたが、
「レジストリの設定」と記載があり、それについてググると、レジストリはmacには無いようなのでこのページは諦めました。
(4つコマンド実行しましたが特に何も出ず。)
試したこと2
今度は「If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'」の部分をググって
こちらのサイトが出てきたのでこのページのコマンド全て試し,再び
$ npm install -g firebase-tools
を実行すると
下記のエラーが出ました。
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/firebase-tools/node_modules/archiver-utils/node_modules/readable-stream'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/firebase-tools/node_modules/archiver-utils/node_modules/readable-stream']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/firebase-tools/node_modules/archiver-utils/node_modules/readable-stream\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path:
npm ERR! '/usr/local/lib/node_modules/firebase-tools/node_modules/archiver-utils/node_modules/readable-stream' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
試したこと3
Firebase公式サイトで、上からMacOSの手順で順番に実行していきましたが、
「最新のCLIバージョンに更新する」の見出しの、
「スタンドアロン バイナリ: 新しいバージョンをダウンロードして、システム上のバージョンを置き換えます。」の部分で、
ダウンロードまでは完了したものの、システム上のバージョンの置き換え方がわかりませんでした。
そのまま下に記載のある
を実行しましたが、
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/firebase-t - Not found
npm ERR! 404
npm ERR! 404 'firebase-t@latest' 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:
とエラーが出ました。
試したこと4
Firebase CLI 最新版 更新
とググって出てきたこちらのサイトをヒントに、
を実行すると、
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
> protobufjs@6.8.8 postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/protobufjs
> node scripts/postinstall
+ firebase-tools@7.8.1
added 112 packages from 102 contributors, removed 9 packages, updated 38 packages and moved 3 packages in 18.326s
ffft:~ $ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
ffft:~ $ sudo npm i -g firebase-tools
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
+ firebase-tools@7.8.1
updated 1 package in 13.066s
できた・・・