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.

Module not found: Error: Can't resolve './/server/main'

See original GitHub issue

Any idea why I am getting this error I dont have any additional changes on this I just install ng-toolkit after npm run build:prod the result is this. Thanks in advance

WARNING in ./node_modules/@angular/core/fesm5/core.js System.import() is deprecated and will be removed soon. Use import() instead. For more info visit https://webpack.js.org/guides/code-splitting/ @ ./server.ts 4826:15-36 5:13-37

WARNING in ./node_modules/@angular/core/fesm5/core.js System.import() is deprecated and will be removed soon. Use import() instead. For more info visit https://webpack.js.org/guides/code-splitting/ @ ./server.ts 4838:15-102 5:13-37

WARNING in configuration The ‘mode’ option has not been set, webpack will fallback to ‘production’ for this value. Set ‘mode’ option to ‘development’ or ‘production’ to enable defaults for each environment. You can also set it to ‘none’ to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in ./server.ts Module not found: Error: Can’t resolve ‘.//server/main’ in ‘d:\tosh-wot-angular’ @ ./server.ts 19:9-34 npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! wot@0.0.0 build:server:prod: ng run wot:server && webpack --config webpack.server.config.js --progress --colors npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the wot@0.0.0 build:server:prod 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\Lenovo\AppData\Roaming\npm-cache_logs\2018-06-13T09_42_06_176Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! wot@0.0.0 build:prod: npm run build:server:prod && npm run build:browser:prod npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the wot@0.0.0 build:prod 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\Lenovo\AppData\Roaming\npm-cache_logs\2018-06-13T09_42_06_441Z-debug.log

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
maciejtredercommented, Jun 21, 2018

Hey. Your project is not in latest Angular. @ng-toolkit supports Angular 6+. Please update to the latest Angular version 😃

2reactions
BovineEnthusiastcommented, Oct 19, 2019

Angular 8 here, same issue. Not sure if it matters, but when I ran ng add @ng-toolkit/universal I had a ton of ts errors (mostly implicit anys and unused references) in the generated server.ts and prerender.ts files.

> node local.js

internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module 'require("./server/main")'
Read more comments on GitHub >

github_iconTop Results From Across the Web

11 - Stack Overflow
build:universal. I got this error: ; ERROR in ./server.ts Module not found: Error: Can't resolve './dist/server/main.bundle' in ... @ ./server.ts ...
Read more >
Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you're seeing a "module not found: error: can't resolve," in your Javascript code, here's an explanation as to why and how to...
Read more >
Angular Universal Hi I've sent you a matcard ... - ADocLib
Angular 6 Server Side Errror: Module Not Found: Error: Can't Resolve './Dist/Server/Main.Bundle'. @darknessm0404 You can debug it like a normal node.js ...
Read more >
Module not found: Error: Can't resolve 'http' [Solved] | bobbyhadz
The error Module not found: Error: Can't resolve 'http' occurs because there has been a breaking change in Webpack version 5. To solve...
Read more >
Search - appsloveworld
Coding example for the question Module not found: Error: Can't resolve './C:/Users/user/AppData/Roaming/npm/node_modules/next/dist/client/next.js' in ...
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