Getting error while serving angular universal locally in firebase
See original GitHub issuemukeshkumarbehera@Mukeshs-MacBook-Air functions % firebase serve --only functions,hosting
⚠ Your requested "node" version "8" doesn't match your global version "12"
i functions: Watching "/Users/mukeshkumarbehera/Desktop/myWebsite/programingwizard/functions" for Cloud Functions...
i hosting: Serving hosting files from: public
✔ hosting: Local server: http://localhost:5000
⚠ Error: Cannot find module '/Users/mukeshkumarbehera/Desktop/myWebsite/programingwizard/functions/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:323:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:681:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:944:27)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at /usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:664:33
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
⚠ We were unable to load your functions code. (see above)
- It appears your code is written in Typescript, which must be compiled before emulation.
- You may be able to run "npm run build" in your functions directory to resolve this.
⚠ Error: Cannot find module '/Users/mukeshkumarbehera/Desktop/myWebsite/programingwizard/functions/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:323:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:681:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:944:27)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at /usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:664:33
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
⚠ We were unable to load your functions code. (see above)
- It appears your code is written in Typescript, which must be compiled before emulation.
- You may be able to run "npm run build" in your functions directory to resolve this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Can't deploy Angular 9 app with Angular Universal to Firebase ...
It's all working fine on localhost:4000 after npm run serve:ssr . But when I launch firebase serve command, things start to go wrong....
Read more >Integrate Angular Universal | Firebase Hosting - Google
With the Firebase framework-aware CLI, you can deploy your Angular application to Firebase and serve dynamic content to your users.
Read more >Angular Universal SSR with Firebase - Fireship
Universal is a tool that can run your Angular app on the server, allowing fully rendered HTML to be served on any route....
Read more >Angular Server-Side Rendering with Cloud Functions 2021
Hello, in this tutorial, I will show you why and how to get your Angular project ready for Server-Side Rendering using Angular Universal...
Read more >Deploying an Angular 8 Universal App to Firebase with CircleCI
Step 9 : Adding Angular Universal to Project ... This will install all required packages to node_modules, which is required to compile this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just created the template project for firebase functions and ran into the same problem. The thing for me was that I didn’t know you require to transpile TS to JS before running the emulator, so, before running:
firebase emulators:start
You should run:npm run build
I hope this helped someone 😛 Link to documentation: https://firebase.google.com/docs/functions/typescript?authuser=0#emulating_typescript_functions
this should be run in the functions folder
it says it in his error code here
ran into the same problem and this worked. Keep in mind you may have to resolve some node version conflicts if you are using a version other than the one in the functions
package.json
file. Mine was on12