VadimDez / ngx-order-pipe

▼ Angular 5+ orderBy pipe
https://vadimdez.github.io/ngx-order-pipe/
MIT License
243 stars 57 forks source link

Cannot find module, when server side building with Angular Universal / Platform Server #25

Closed CramericaIndustries closed 6 years ago

CramericaIndustries commented 7 years ago

Hi, when I'm launching my app with Angular Universal / Platform Server I get the following error:

Error: Cannot find module 'ngx-order-pipe' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/workdir/product-comperator/src/app/app.module.ts:21:1) at Module._compile (module.js:571:32) at Module.m._compile (/workdir/product-comperator/node_modules/ts-node/src/index.ts:392:23) at Module._extensions..js (module.js:580:10) at Object.require.extensions.(anonymous function) [as .ts] (/workdir/product-comperator/node_modules/ts-node/src/index.ts:395:12) at Module.load (module.js:488:32)

this is the command that I use to launch the app with Universal: ts-node --ignore=false src/server.ts

No errors are thrown when I launch my app with ng serve. The ngx-order-pipe is then working quite nicely. Angular Universal has no problem finding the other third party module (ng2-nouislider) that I'm using in my project. It is stored in the _nodemodules directory as well. Therefore I'm not sure if the root of the problem is in my project or in the ngx-order-pipe code.

I'm importing the ngx-order-pipe in my app.module.ts file like so: import { OrderModule } from 'ngx-order-pipe'; and this is how I'm importing the ng2-nouislider: import { NouisliderModule } from 'ng2-nouislider';

Some more info about my environment:

angular/cli: 1.2.7 node: 7.10.1 os: linux x64 angular/animations: 4.3.3 angular/common: 4.3.3 angular/compiler: 4.3.3 angular/core: 4.3.3 angular/forms: 4.3.3 angular/http: 4.3.3 angular/platform-browser: 4.3.3 angular/platform-browser-dynamic: 4.3.3 angular/platform-server: 4.3.3 angular/router: 4.3.3 angular/cli: 1.2.7 angular/compiler-cli: 4.3.3 angular/language-service: 4.3.3

NPM: 4.2.0 ngx-order-pipe@1.0.2

Thanks for your help in advance!

darkbasic commented 6 years ago

+1

VadimDez commented 6 years ago

Could you tell me how can I reproduce this issue? What kind of starter did you use etc? I've just tried with angular universal and had no problems.

darkbasic commented 6 years ago

I tried to use it inside this component: https://github.com/Urigo/angular-meteor-docs/blob/master/src/app/website/tutorials-container/tutorials-container.component.ts

Please note that this codebase is heavily outdated, it still uses the old angular2-universal, doesn't work with node.js 8 and requires you to use yarn instead of npm to get it working.

VadimDez commented 6 years ago

Could you test if you're still getting the error in latest version 1.1.2?

VadimDez commented 6 years ago

Closing due to missing feedback