I want to integrate angular universal into my project and I use AngularFire library. But when I test my app locally by running npm run build && npm run serve:ssr.
I have this error
webpack:///./dist/server/main.js?:95613
throw err;
^
Error: ENOENT: no such file or directory, open 'google/protobuf/api.proto'
at Object.openSync (fs.js:440:3)
at Object.readFileSync (fs.js:342:35)
at fetch (webpack:///./dist/server/main.js?:95679:34)
at Root.load (webpack:///./dist/server/main.js?:95713:13)
at Root.loadSync (webpack:///./dist/server/main.js?:95754:17)
at Object.loadSync (webpack:///./dist/server/main.js?:133270:17)
at Object.8ZNE (webpack:///./dist/server/main.js?:98662:37)
at __webpack_require__ (webpack:///./dist/server/main.js?:20:30)
at Object.BYZf (webpack:///./dist/server/main.js?:104679:19)
at __webpack_require__ (webpack:///./dist/server/main.js?:20:30) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: 'google/protobuf/api.proto'
I got this from another post, but it did help me out to fix that error (I had been looking for fixes for a while now).
Hope it works for you
angular.json
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/TeacherKellyUKA/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json",
"externalDependencies": ["@firebase/firestore"]
},
This is an issue with AngularFirestoreModule. I have updated below line in package.json and it is working fine. I am using angular version 8.
"bundleDependencies all" to "bundleDependencies none"
"build:client-and-server-bundles": "ng build --prod && ng run web:server:production --bundleDependencies none"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With