vue create で作成したプロジェクトでコンパイルエラーが発生した場合
vue createでプロジェクトを作成
vue create my-project
vue create my-project
質問をマニュアルで進め、無事プロジェクトの作成に成功したので開発サーバーを起動します。
cd my-project
npm run serve
エラー発生
すると、次のようなエラーが
ERROR Failed to compile with 1 errors
error in ./src/main.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] <project-path>/my-project/src/main.js: Package exports for
'<project-path>my-project/node_modules/@babel/helper-compilation-targets'
do not define a '.' subpath (While processing:
"<project-path>/my-project/node_modules/@vue/cli-plugin-babel/preset.js")
解決策
Node.jsのバージョンを13.2.0
以上にあげる必要があります。
Node.jsのバージョンを上げる方法
nをインストール
Node.jsのバージョン管理ツールであるnをインストールします。
npm install -g n
最新バージョンを確認
n --stable
で安定版、n --latest
で最新版を確認できます。
2019/1/20 現在の実行結果です。
n --stable
12.14.1
n --latest
13.6.0
最新版をインストール
n latest
sudo
が要求されたら、sudo n latest
のようにして実行してください。
インストールされたかバージョンを確認します。
node -v
参考サイト
Error: Package exports for /node_modules/@babel/helper-compilation-targets' do not define a '.' subpath
Node.jsとnpmをアップデートする方法 | Rriver
Author And Source
この問題について(vue create で作成したプロジェクトでコンパイルエラーが発生した場合), 我々は、より多くの情報をここで見つけました https://qiita.com/azukiazusa/items/4127b3cf812d36cc368d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .