vue cliでアプリケーションを作った際に起きたことをメモ
環境
virtual boxでの仮想環境on Windows 10
OS: ubuntu 18.04
WSLは特有の謎現象が多いので趣味で使うのをやめた
背景
vue cliをインストール&アプリケーションを新規作成
npm install -g @vue/cli
sudo vue create my app
エラー内容(ディレクトリ名などに含まれる具体的な名称は消してます)
Vue CLI v4.5.9
WARN You are using an outdated version of NPM.
there may be unexpected errors during installation.
Please upgrade your NPM version.
✨ Creating project in /home/Project/myapp/myapp.
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Linux 5.4.0-53-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--loglevel" "error" "@vue/cli-plugin-babel@~4.5.0" "@vue/cli-plugin-eslint@~4.5.0" "@vue/cli-service@~4.5.0" "--save-dev"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/Project/myapp/myapp/npm-debug.log
ERROR command failed: npm install --loglevel error @vue/cli-plugin-babel@~4.5.0 @vue/cli-plugin-eslint@~4.5.0 @vue/cli-service@~4.5.0 --save-dev
対処
ここに書いてあった。
sudo npm install -g n
sudo n latest
sudo npm install -g npm
hash -d npm
npm i
一通り実行したところアプリケーションの作成に成功した。