question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: npm run build:prerender

See original GitHub issue

I’m submitting a…


[ ] Bug report  

In package


[ ] @ng-toolkit/universal

Current behavior

everything works well when creating initial new angular project with CLI. But when i add components + modules + lazy loaded module, prerender build does not work anymore.

Expected behavior

Build prerender to be working with angular 8 web app.

Minimal reproduction of the problem with instructions

step 1) npm run build:prerender step 2) output error:


fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'src/./app/./core-routing.module.ts'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at identifiers.forEach.identifier (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ssr\dist\prerender.js:129207:42)
    at Array.forEach (<anonymous>)
    at findRoutes (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ssr\dist\prerender.js:129206:21)
    at identifiers.forEach.identifier (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ssr\dist\prerender.js:129207:28)
    at Array.forEach (<anonymous>)
    at findRoutes (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ssr\dist\prerender.js:129206:21)
    at identifiers.forEach.identifier (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ssr\dist\prerender.js:129207:28)
    at Array.forEach (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! artkauric-ssr@0.0.0 build:prerender: `npm run build:prod && node dist/prerender.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the artkauric-ssr@0.0.0 build:prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\****\AppData\Roaming\npm-cache\_logs\2020-01-07T06_47_22_870Z-debug.log

This is my lazy loaded module where it seems to have a problem finding the file:


export const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: 'coming-soon' },
  {
    path: 'coming-soon',
    loadChildren: () => import('./core/core.module').then(m => m.CoreModule)
  },
];

It looks like the webpack is fetching the complete path ‘./core/core.module’ instead of ‘core/core.module’ and is doing the same with ‘./app’ instead of ‘app’

Environment

My package.json


  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.4",
    "@angular/common": "~8.2.4",
    "@angular/compiler": "~8.2.4",
    "@angular/core": "~8.2.4",
    "@angular/forms": "~8.2.4",
    "@angular/platform-browser": "~8.2.4",
    "@angular/platform-browser-dynamic": "~8.2.4",
    "@angular/platform-server": "~8.2.4",
    "@angular/router": "~8.2.4",
    "@bugsnag/js": "^6.5.0",
    "@ng-toolkit/universal": "^7.1.2",
    "@nguniversal/common": "0.0.0",
    "@nguniversal/express-engine": "0.0.0",
    "@nguniversal/module-map-ngfactory-loader": "0.0.0",
    "angular-particle": "^1.0.4",
    "core-js": "^3.6.2",
    "domino": "^2.1.3",
    "express": "^4.15.2",
    "ngx-quicklink": "^0.2.0",
    "parallax-js": "^3.1.0",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.2",
    "@angular/cli": "~8.3.2",
    "@angular/compiler-cli": "~8.2.4",
    "@angular/language-service": "~8.2.4",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-loader": "^5.2.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3",
    "webpack-cli": "^3.1.0"
  }

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
tkau87commented, Jan 8, 2020

I get the following error with @ng-toolkit/universal (should be 8.0.3).


fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'src/@nguniversal/module-map-ngfactory-loader.ts'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Module.<anonymous> (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ng-ssr\dist\prerender.js:2846:29)
    at __webpack_require__ (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ng-ssr\dist\prerender.js:21:30)
    at C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ng-ssr\dist\prerender.js:85:18
    at Object.<anonymous> (C:\Users\sgtra\Desktop\assia\appWorkspace\WEBSITE\akcws02\artkauric-ng-ssr\dist\prerender.js:88:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! artkauric-ng-ssr@0.0.0 build:prerender: `npm run build:prod && node dist/prerender.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the artkauric-ng-ssr@0.0.0 build:prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sgtra\AppData\Roaming\npm-cache\_logs\2020-01-08T12_56_43_865Z-debug.log
0reactions
sukhminderxcommented, Apr 12, 2020

sure thing, I’ll test it. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem running Build command: npm run prerender
6 of netlify build when trying to execute the Build command: npm run prerender it gives me the following error, does anyone know...
Read more >
Getting TypeError on prerendering page in npm run build
When handling a dynamic page such as /blog/[slug].jsx you need to use getStaticPaths in addition to getStaticProps and router.
Read more >
prerender
Prerender. Prerender is a node server that uses Headless Chrome to render HTML, screenshots, PDFs, and HAR files out of any web page....
Read more >
Npm run build problem - Questions
... when i run npm run dev in my terminal i see the error as below : can ... Npm run build problem...
Read more >
A new Error: Command "npm run build" exited with 1
Hi every one ! I try to deploy my project on vercel but It doesn't work. I tried to : change my package.json...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found