Reputation: 5929
Linux (Amazon Linux AMI)
angular-cli: 1.0.0-beta.22-1
node: 6.6.0
os: linux x64
I installed recently PouchDB:
npm i pouchdb --save
npm i @types/pouchdb --save-dev
I added this in typings.d.ts:
declare module 'PouchDB';
And now I import PouchDB in my service:
import * as PouchDB from 'PouchDB';
Well, all is okey in my laptop (MacOS Sierra); ng serve
, ng build
without problems and PouchDB is working well.
But... Not the same thing in my server (Amazon Linux AMI)... 😐
I'm getting the next error trying to execute ng build
:
ERROR in ./src/app/pictures.service.ts
Module not found: Error: Can't resolve 'PouchDB' in '/home/aral/project/src/app'
@ ./src/app/pictures.service.ts 11:0-35
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
I have the same angular-cli version and node version that in my laptop... 😧
And I compared doing tree
command in my laptop and my server and both have the same files. (Except some sub-dependency in node_modules
).
Thank you!
Issue reported in GitHub: https://github.com/angular/angular-cli/issues/3698
Upvotes: 2
Views: 1754
Reputation: 49
Checking in package.json file whether the pounchbd dependency is included or not, if it is not included, then add this dependency "pouchdb": "^7.2.2" and run npm install
Upvotes: 0
Reputation: 5929
I was using Mac in my laptop and this is the reason why in my laptop don't have this issue: Because the Mac main filesystem is case insensitive. Linux is not so forgiving. So importing from PouchDB the system is looking for a node_modules names PouchDB, but it's really named pouchdb (lowercase).
Upvotes: 2