3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

FirebaseでのデプロイでPlease verify that the package.json has a valid "main" entryが出た時の対処方法。

Last updated at Posted at 2021-03-31

はじめに

Firebaseでデプロイしようとしたらこんなエラーメッセージが出たので対処方法を教えます。

エラー内容

=== Deploying to 'animelike-81816'...

i  deploying firestore, functions, hosting
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module '/Users/___/React/functions/lib/index.js'. Please verify that the package.json has a valid "main" entry

Try running "npm install" in your functions directory before deploying.

簡単にいうとfunctionsフォルダがなんかおかしいぞ。おかしいからnpm installしとけ。とのこと。

対処方法

functionsフォルダの中のpackage-lock.jsonを一度削除してください。
そしてnpmを再インストール

$ cd functions
$ npm install
$ firebase deploy
Deploy complete!

日本語の記事だと出てこなかったので海外サイトで探しました。
参考にしたサイト↓
https://stackoverflow.com/questions/66207737/please-verify-that-the-package-json-has-a-valid-main-entry

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?