You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have followed the guidelines of setting this up to a T. I'm not sure what is means by AppBrowserModule since I only have an AppModule and a AppServerModule. But when running npm run dev:ssr, I get the following error:
NullInjectorError: R3InjectorError(AppServerModule)[InjectionToken AuthServiceInterface -> CookieService -> p -> p -> p]: NullInjectorError: No provider for p!
import'zone.js/dist/zone-node';import{ngExpressEngine}from'@nguniversal/express-engine';import*asexpressfrom'express';import*ascookieParserfrom'cookie-parser';import{join}from'path';import{AppServerModule}from'./src/main.server';import{APP_BASE_HREF}from'@angular/common';import{existsSync}from'fs';import{environment}from'@environment';// The Express app is exported so that it can be used by serverless Functions.exportfunctionapp(){constserver=express();constdistFolder=join(process.cwd(),'dist/ideal-sale-circular/browser');constindexHtml=existsSync(join(distFolder,'index.original.html')) ? 'index.original.html' : 'index';server.use(cookieParser(environment.secretKey));// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)server.engine('html',ngExpressEngine({bootstrap: AppServerModule}));server.set('view engine','html');server.set('views',distFolder);// Example Express Rest API endpoints// app.get('/api/**', (req, res) => { });// Serve static files from /browserserver.get('*.*',express.static(distFolder,{maxAge: '1y'}));// All regular routes use the Universal engineserver.get('*',(req,res)=>{res.render(indexHtml,{ req,providers: [{provide: APP_BASE_HREF,useValue: req.baseUrl}]});});returnserver;}functionrun(){constport=process.env.PORT||4000;// Start up the Node serverconstserver=app();server.listen(port,()=>{console.log(`Node Express server listening on http://localhost:${port}`);});}// Webpack will replace 'require' with '__webpack_require__'// '__non_webpack_require__' is a proxy to Node 'require'// The below code is to ensure that the server is run only when not requiring the bundle.declareconst __non_webpack_require__: NodeRequire;constmainModule=__non_webpack_require__.main;constmoduleFilename=mainModule&&mainModule.filename||'';if(moduleFilename===__filename||moduleFilename.includes('iisnode')){run();}export*from'./src/main.server';
This is my server.ts file. Again, not sure how to use the LAZY_MODULE_MAP since that doesn't work in Angular 9 anymore.
Then last, but not least, my file that is injecting the cookies service.
I have followed the guidelines of setting this up to a T. I'm not sure what is means by AppBrowserModule since I only have an AppModule and a AppServerModule. But when running
npm run dev:ssr
, I get the following error:NullInjectorError: R3InjectorError(AppServerModule)[InjectionToken AuthServiceInterface -> CookieService -> p -> p -> p]: NullInjectorError: No provider for p!
Here is my following code:
This is my app.module.ts file.
This is my app.server.module.ts file.
This is my server.ts file. Again, not sure how to use the LAZY_MODULE_MAP since that doesn't work in Angular 9 anymore.
Then last, but not least, my file that is injecting the cookies service.
This is just a cookies service that my app interacts to get, remove, etc. It's basically a wrapper for any cookie package I was planning on using.
The text was updated successfully, but these errors were encountered: