-
Notifications
You must be signed in to change notification settings - Fork 481
npm run serve:ssr : package.json does not exist #1207
Comments
Did u get to solve this issue?? |
Not yet, hoping for a response from the community. |
The problem is "build:client-and-server-bundles": "ng build --prod && ng run your-project:server:production --bundleDependencies all" in package.json . When you change it to ng run your-project:server:production --bundleDependencies none it works. But if you try to package it, the externals are getting messed up. |
Thanks @kpsrinivas . We don't currently allow configuring what libraries should be made external. Can you tell me which library you are trying to use that is causing this issue? |
Not the library. When I try to package my server as umd and import it for firebase functions. |
This step https://github.com/angular/angularfire2/blob/master/docs/universal/cloud-functions.md fails |
We have multiple people using angular fire who seem to have problem with --bundleDependencies all. The current workaround is to just remove/set --bundleDependencies none. We are going to follow up with angularfire folks to fix this properly |
Has anyone solved this issue yet? |
|
This sounds like a work around rather than a solution. |
i have tried "--bundleDependencies none" but still getting error |
@zeeshanshanif - Anyway you can create a repro github repo? @BeSpunky - Bundling does help in fast cold start times and so it is definitely the way we are heading towards. But there are some packages that don't bundle well - And we want to provide an escape hatch for those cases. In some cases it might just be temporary as we figure out how to bundle a particular dependency better. |
any Updates? "--bundleDependencies none" work to avoid "package.json" issue but i faced another issue as i guess that the SSR doesn't wait for observable to fetch data from Firestore! i don't know how to properly fix this. all i want is to fetch user object from Firestore & update meta tags for Facebook Crawls share debugger!!!! any Help Would be appreciated. Thanks |
If you solved the bundling problem, your question is not related to this thread. |
This worked with Angular 8, but with not with Angular 9 (see below)
Is this supposed to work with Angular 9? The workaround used to work - but now the component's template and styles won't get bundled anymore |
@Gbuomprisco can you please provide a reproduction of the problem that we can take a look at? |
Hi @alan-agius4, my issue seems to be the same as this #1327. Unfortunately, I also run into angular/angular#34544 while running the |
Can someone please put up a minimal reproduction of the firebase with bundles dependencies issue? Unfortunately, without a reproduction we’ll not be able to look at this issue. A good way to make a minimal repro is to create a new app via This might be related to your directory structure so its really important to get an accurate repro to diagnose this. |
I can't from my office, but I'll push one this evening. Thanks a lot for the help, really appreciated! |
Added reproduction here: https://github.com/Gbuomprisco/ng-ssr-fire If I use bundleDependencies false, I get the following error:
If I don't set bundleDependencies to false, I get this error:
I also tried running It's weird I am not getting the same error. I'll try more configurations. |
I'll take a look at the repo in the coming days. But See the docs: https://next.angular.io/guide/ivy#ivy-and-universalapp-shell |
Thanks a lot, I'll be updating the comment as I try more stuff |
@Gbuomprisco, thanks for the reproduction. I was able to look at it. To resolve the Ex: "server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/ng-ssr-fire/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json",
"externalDependencies": [
"grpc"
]
},
"configurations": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": true
}
}
}, |
Hey @alan-agius4, thank you for looking into this. Unfortunately, it looks like some issues remain. With the repository I posted, I am getting this issue:
With my actual project, instead, I am getting this:
|
I am getting following error:
|
@bharatbiswal, you need to update to Angular and Angular-CLI 9. |
@Gbuomprisco, I’ll take a look at the other errors later on today. |
@Gbuomprisco the For the other error try adding the below: "externalDependencies": [
"grpc",
"@grpc/proto-loader"
] |
Might be related angular/angularfire#2284 |
this does resolve the build error. but when the function executes, it gives a runtime error
angular version 9^ |
@ranjitpatra you also need to exclude See: #1207 (comment) |
@kuncevic yeah, I got the same error for using angularfire. current workaround is by setting grpc as externalDependencies as @alan-agius4 said. |
If you can, you could create a separate module for Browser, and import AngularFire modules there. For example, create a app.browser.module.ts - and add all your AngularFire imports there. Then just point your main.ts file to bootstrap from that module instead. |
@codemysoul there is no point of SSR, if you only include those in the browser bundle. |
I have a similar issue.
I am using |
This is still happening in 9.1 adding grpc stuff in angular.json doesn't work!
|
add this
I already create an PR to clarify that https://github.com/angular/angularfire/pull/2372/files?short_path=e76f33d#diff-e76f33db0439ee8e320dfa7ecf47f09b |
example repository follow that instruction above here: https://github.com/hiepxanh/angular-fire-universal |
I fixed error "Element is not defined" deleting "ng-inline-svg": "^8.5.1", in package.json, Angular 9 |
Adding |
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report
What is the expected behavior?
npm run build:ssr is building without errors. npm run serve:ssr is not running as expected
What is the current behavior?
npm run serve:ssr fails with the following errors
What modules are related to this issue?
Minimal reproduction with instructions:
What is the use-case or motivation for changing an existing behavior?
Environment:
@nguniversal versions
Output from:
ng --version
.Is there anything else we should know?
Working on Angular 8.1 with Firestore
Tried modifying webpack.server.config.js, package.json and server.ts based on the issue here https://stackoverflow.com/questions/57030914/firebase-firestore-not-working-with-angular-universal-package-json-does-not-exi
webpack.server.config.js
server.ts
Package.json
The text was updated successfully, but these errors were encountered: