Can't Build Because of netlify/angular-runtime/common-engine

Hey, I’m fairly new to Netlify, have uploaded a few real simple sites but am uploading an angular site

https://nerdyfroggames.netlify.app

and having some issues. Whenever I ran netlify build I got caught with an issue in my server.ts that it was missing something, so I followed the suggestions in the cli and now I’m getting

Cannot find module ‘@netlify/angular-runtime/common-engine’ or its corresponding type declarations.

The closest help I’ve found online is the angular-runtime dependency, but I get a laundrylist of errors when I try running that. Does anyone have experience with this issue? Thanks. (Also here’s the server.ts, I’m not sure what else would help)

import { APP_BASE_HREF } from '@angular/common';

import { CommonEngine, isMainModule } from '@angular/ssr/node';
import { render } from '@netlify/angular-runtime/common-engine';

import express from 'express';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import AppServerModule from './main.server';

const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');

const app = express();
const commonEngine = new CommonEngine();

export async function netlifyCommonEngineHandler(request: Request, context: any): Promise<Response> {
  return await render(commonEngine)
}

/**
 * Example Express Rest API endpoints can be defined here.
 * Uncomment and define endpoints as necessary.
 *
 * Example:
 * ```ts
 * app.get('/api/**', (req, res) => {
 *   // Handle API request
 * });
 * ```
 */

/**
 * Serve static files from /browser
 */
app.get(
  '**',
  express.static(browserDistFolder, {
    maxAge: '1y',
    index: 'index.html'
  }),
);

/**
 * Handle all other requests by rendering the Angular application.
 */
app.get('**', (req, res, next) => {
  const { protocol, originalUrl, baseUrl, headers } = req;

  commonEngine
    .render({
      bootstrap: AppServerModule,
      documentFilePath: indexHtml,
      url: `${protocol}://${headers.host}${originalUrl}`,
      publicPath: browserDistFolder,
      providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
    })
    .then((html) => res.send(html))
    .catch((err) => next(err));
});

/**
 * Start the server if this module is the main entry point.
 * The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
 */
if (isMainModule(import.meta.url)) {
  const port = process.env['PORT'] || 4000;
  app.listen(port, () => {
    console.log(`Node Express server listening on http://localhost:${port}`);
  });
}

hey @nerdyfrog thanks for reaching out and apologies for the delay on this one! you mentioned:

can you provide additional context on the specific steps leading to those errors?

This
Cannot find module ‘@netlify/angular-runtime/common-engine’ or its corresponding type declarations. error suggests that the adapter hasn’t yet been installed properly, for which you’d want to run npm install @netlify/angular-runtime then import it in your server.ts file.

If you’re still having issues, providing us with some example build logs from the CLI might help. Thanks again!