create-next-appのdeployで困ったエラー『ReferenceError: Unknown option: .configFile.』

Firebase

create-next-appのサンプル『with-firebase-hosting』を使いたかったのだが、deploy時にエラーが発生してしまっていた。

エラー内容

npm run deployをすると

ReferenceError: Unknown option: .configFile. Check out http://babeljs.io/docs/usage/options/ for more information about options.
at buildUnknownError (/home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/config/validation/options.js:98:11)
at /home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/config/validation/options.js:84:57
at Array.forEach (native)
at validate (/home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/config/validation/options.js:62:21)
at loadPrivatePartialConfig (/home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/config/partial.js:28:48)
at loadFullConfig (/home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/config/full.js:33:37)
at /home/ec2-user/environment/with-firebase-hosting-app2/node_modules/@babel/core/lib/transform-file.js:36:33
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:613:11)

調べてみると、どうやら@babel/cliと@babel/coreのバージョン不一致が原因みたい。

@babel/cli throws: “Unknown option: .configFile” · Issue #7797 · babel/babel
Choose one: bug Minimal invocation of @babel/cli v7.0.0-beta.46 throws Unknown option: .configFile Input Code echo | npx babel --no-babelrc echo | npx babel -f ...

package-lock.jsonを見てみると、@babel/cliのversionは”7.0.0″、一方@babel/coreは”7.0.0-beta.42″。7.0.0は数日前なのにbeta.42は更新が数ヶ月前。ここがあやしそう。

 

npmパッケージを一度クリーンに

rm -rf node_modules/*
rm package-lock.json

 

 

{
  "dependencies": {
    "@babel/core": "^7.0.0",
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/cli": "^7.0.0",
  }
}

 

npm install

 

コメント