【Vue.js入門】Vue CLIのインストールでERR

6.単一ファイルコンポーネントによる開発

6月からスタートした朝30分の勉強もかなり進みました。

ちょっとずつの積み重ねは素晴らしい。

初めてかも。こうやって本1冊まるっと勉強するのって。

Vue.js入門 基礎から実践アプリケーション開発まで

Vue.js入門 基礎から実践アプリケーション開発まで

webukatu.com

ツールのインストール

コマンドラインにツールをインストールするってところでいきなり「ERR」で困ったのでした。

$ npm install -g @vue/cli@3.0.1 @vue/cli-service-global@3.0.1
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
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:
npm ERR!     /Users/waka/.npm/_logs/2019-06-25T23_21_30_586Z-debug.log

何がいけなかったのでしょうか・・・

最初の

npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.

で検索してみたら、stackoverflowの英語のページがヒットして・・・

Do you have another terminal open?

ってところだけかろうじて意味がわかったので、開いてた他のターミナルを全部閉じてみました。

が、同じだよね。。。

何が!!!!

って珍しくちゃんと本を読んでみたの。

そうしたら注釈部分に

「ここではVue CLIをコマンドとしていつでも利用できるようにするための処理を行っています。 環境によっては管理者権限が必要となることもあります。」

って。

おぉ〜そんなことがあったね。そう言えば。

昼間の仕事Windowsなので、久方ぶりにMacのターミナルを触ると自然に忘れるのです。

ってことで再度チャンレンジ

sudo npm install -g @vue/cli@3.0.1 @vue/cli-service-global@3.0.1
Password:

....
....
....

$ vue --version
3.0.1

ってことらしいです。真ん中、いろんなメッセージ出てたけど、ま、これが出たらOKでしょ。

朝からマックでやることではないような気もしたのでした。

webukatu.com