node.jsangularnpmserver-side-rendering

angular SSR using @nguniversal/express-engine package get this error (ERROR in error TS6053: File '/project/src/server.ngtypecheck.ts' not found.)


I am using @nguniversal/express-engine to Server Side Rendering in angular.When I run $ nmp build:ssr or $ npm run dev:ssr i get this error.

ERROR in error TS6053: File 'C:/dev/web/workspace/project/src/server.ngtypecheck.ts' not found.
error TS6053: File 'C:/dev/web/workspace/project/src/server.ts' not found.
error TS6053: File 'C:/dev/web/workspace/project/src/src/main.server.ngtypecheck.ts' not found.
error TS6053: File 'C:/dev/web/workspace/project/src/src/main.server.ts' not found.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.0.0 build:ssr: `ng build --prod && ng run client:server:production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.0.0 build:ssr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

Solution

  • Had the same issue, the doubling-up of src/src is occurring from tsconfig.server.json. I encountered this error running build:ssr for Angular, the solution as described here is quite simple. We need to edit the src/tsconfig.server.json.

    I had to make two changes; both were described in that solution.

    Navigate to src/tsconfig.server.json

    Props to the other thread for the solution really.