question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firebase Hosting Deploy Error ERR_PACKAGE_PATH_NOT_EXPORTED

See original GitHub issue

Environment

  • Operating System: Darwin
  • Node Version: v16.11.1
  • Nuxt Version: 3.0.0-27296423.f3082ca
  • Package Manager: yarn@1.22.17
  • Bundler: Vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

The problem happens on a fresh install of Nuxt using yarn or npm and by following the official Firebase Hosting guide with both methods: Using Nitro and Using Firebase CLI.

A minimal reproduction can be found on this git.

  1. npx nuxi init nuxt3-app
  2. cd nuxt3-app
  3. yarn install
  4. yarn global add firebase-tools
  5. yarn add --dev firebase-admin firebase-functions firebase-functions-test
  6. firebase init hosting
  • Please select an option: Use an existing project
  • Select a default Firebase project for this directory: <project name>
  • What do you want to use as your public directory? .output/public
  • Configure as a single-page app (rewrite all urls to /index.html)? No
  • Set up automatic builds and deploys with GitHub? No
  1. NITRO_PRESET=firebase yarn build
  2. firebase deploy

Describe the bug

At the beginning things seem to work:

=== Deploying to '<project-name>'...

i  deploying functions, hosting
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  functions: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled

And then this issue happens:

Error: Error occurred while parsing your function triggers.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './runtime/polyfill/fetch.node' is not defined by "exports" in /Users/duran/Git/firebase-test/.output/server/node_modules/unenv/package.json imported from /Users/duran/Git/firebase-test/.output/server/index.mjs
    at throwExportsNotFound (internal/modules/esm/resolve.js:292:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
    at packageResolve (internal/modules/esm/resolve.js:612:14)
    at moduleResolve (internal/modules/esm/resolve.js:662:14)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:755:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:46:40)
    at link (internal/modules/esm/module_job.js:45:36)

Additional context

  • firebase-tools version 9.23.0
  • Blaze (pay-as-you-go) plan activated
  • No logs on Firebase Web Console
  • Tried with npm and yarn

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tobiasdiezcommented, Nov 26, 2021

I get similar errors for other libraries as well:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/index.mjs' is not defined by "exports" in D:\Programming\JabRefOnline\node_modules\murmurhash-es\package.json imported from D:\Programming\JabRefOnline\.nuxt\nitro\index.mjs

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './esm/index.js' is not defined by "exports" in D:\Programming\JabRefOnline\node_modules\throttle-debounce\package.json imported from D:\Programming\JabRefOnline\.nuxt\nitro\index.mjs

so maybe this is a more general issue?

0reactions
pi0commented, Apr 12, 2022

I guess we shouldn’t have this issue anymore since the migration to nitropack. Please try with the latest dependencies (npx nuxi upgrade --force) and share a recent reproduction to investigate 🙏🏼

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase functions deploy error - Stack Overflow
I have read many solutions about the simillar problems, for example, remove node-modules and package-lock file then re-install them, down grade ...
Read more >
Handling dependencies | Cloud Functions for Firebase - Google
An Artifact Registry Node.js package repository can host private modules for your function. When deploying to Cloud Functions, the build process will ...
Read more >
Firebase web 9.0.1 error Package path . is not exported-node.js
[Solved]-Firebase web 9.0.1 error Package path . is not exported-node.js. Search. score:2. Try this: import * as firebase from "firebase/app".
Read more >
Incident affecting Hosting - Firebase Status Dashboard
We are experiencing an issue Firebase Hosting serving HTTP 503 "time to first byte timeout" errors as of Tuesday, 2020-09-29 15:51 US/Pacific.
Read more >
cloudbuild functions tsc not found - You.com | The AI Search ...
I am trying to use Google Cloud Build to deploy my Firebase functions, but I am running into a weird error. I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found