Module not found: Error: Can't resolve '.'
See original GitHub issueI’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:
- Created 5 years ago
- Reactions:5
- Comments:13 (2 by maintainers)
Top GitHub Comments
Just downgrade the version of ngx-datatable from
"@swimlane/ngx-datatable": "^13.1.0"
to"@swimlane/ngx-datatable": "13.0.0"
. It works.Released in 15.0.0