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 '.'

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior it is working fine if build it using ng serve and ng build --prod. But I am facing issues when I build it for server side rendering with angular universal. I am using following commands to build

npm run build:ssr

ERROR in ./dist/server/main.js Module not found: Error: Can’t resolve ‘.’ in ‘C:\Users\me\Desktop\example\dist\server’ @ ./dist/server/main.js 96:17-29 @ ./server.ts

npm run serve:ssr

example@0.0.0 serve:ssr C:\Users\me\Desktop\example node dist/server

C:\Users\me\Desktop\example\dist\server.js:54955 module.exports = webpack_require(!(function webpackMissingModule() { var e = new Error(“Cannot find module ‘.’”); e.code = ‘MODULE_NOT_FOUND’; throw e; }())); ^

Error: Cannot find module ‘.’ at webpackMissingModule (C:\Users\me\Desktop\example\dist\server.js:54955:82) at Object… (C:\Users\me\Desktop\example\dist\server.js:54955:158) at webpack_require (C:\Users\me\Desktop\example\dist\server.js:54879:30) at Object…/node_modules/@swimlane/ngx-datatable/release/utils/tree.js (C:\Users\me\Desktop\example\dist\server.js:62913:10) at webpack_require (C:\Users\me\Desktop\example\dist\server.js:54879:30) at Object…/node_modules/@swimlane/ngx-datatable/release/utils/index.js (C:\Users\me\Desktop\example\dist\server.js:62194:10) at webpack_require (C:\Users\me\Desktop\example\dist\server.js:54879:30) at Object…/node_modules/@swimlane/ngx-datatable/release/components/header/header-cell.component.js (C:\Users\me\Desktop\example\dist\server.js:59818:15) at webpack_require (C:\Users\me\Desktop\example\dist\server.js:54879:30) at Object…/node_modules/@swimlane/ngx-datatable/release/components/header/header-cell.component.ngfactory.js (C:\Users\me\Desktop\example\dist\server.js:60109:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! example@0.0.0 serve:ssr: node dist/server npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the example@0.0.0 serve:ssr 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\me\AppData\Roaming\npm-cache_logs\2018-10-06T07_02_52_121Z-debug.log

Expected behavior Create ssr build without errors.

Reproduction of the problem I have created a test project to reproduce the issue. Following is the github link. https://github.com/Muhammad-Soban/ngx-datatable-ssr-issue.git

Please tell us about your environment: Operating system: Windows 10 IDE: Webstorm Package manager: npm package.json:

{
  "name": "example",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
    "serve:ssr": "node dist/server",
    "build:client-and-server-bundles": "ng build --prod && ng run example:server",
    "webpack:server": "webpack --config webpack.server.config.js --progress --colors"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/platform-server": "^6.1.9",
    "@angular/router": "^6.1.0",
    "@nguniversal/express-engine": "^6.1.0",
    "@nguniversal/module-map-ngfactory-loader": "^6.1.0",
    "@swimlane/ngx-datatable": "^13.1.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.2.0",
    "ts-loader": "^5.2.1",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular/cli": "~6.2.4",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2",
    "webpack-cli": "^3.1.2"
  }
}
  • Table version:@swimlane/ngx-datatable”: “^13.1.0”

  • Angular version: Angular 6.1.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Muhammad-Sobancommented, Dec 21, 2018

Just downgrade the version of ngx-datatable from "@swimlane/ngx-datatable": "^13.1.0" to "@swimlane/ngx-datatable": "13.0.0". It works.

1reaction
marjan-georgievcommented, May 29, 2019

Released in 15.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack: Module not found: Error: Can't resolve (with relative ...
Your file structure says that folder name is Container with a capital C. But you are trying to import it by container with...
Read more >
Module not found: Can't resolve 'X' error in React | bobbyhadz
To solve the "Module not found: Can't resolve" error in React, make sure to install the package from the error message if it's...
Read more >
How to fix 'Module not found: Error: Can't resolve'?
The first thing you should do is check if the package you're using has been installed and added as a dependency. Depending on...
Read more >
Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you see a “Module not found: error can't resolve” JavaScript error, there's likely a problem with the communication between the module you're...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
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