jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.31k stars 356 forks source link

Not able to get it working with Angular 5 #154

Closed iamsank8 closed 4 years ago

iamsank8 commented 4 years ago

I am getting below errors while serving the application.

ERROR in node_modules/idb/with-async-ittr.d.ts(1,15): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './build/esm/index' instead. src/app/shared/services/data.service.ts(10,10): error TS2305: Module '"D:/DEV/HSE/ARA.WebApp/node_modules/idb/with-async-ittr"' has no exported member 'openDB'.

jakearchibald commented 4 years ago

I'm not familiar with Angular. Can you create a minimal reproduction of the issue?

iamsank8 commented 4 years ago

Hi I have created this project. please use "npm install" using command prompt. Please let me know if you need more help running this project.

shireefadel commented 4 years ago

I have the same issue Module '"..//node_modules/idb/with-async-ittr"' has no exported member 'openDB'.

jakearchibald commented 4 years ago

@Sankey28 did you forget the link to the project?

iamsank8 commented 4 years ago

Sorry my bad. Here it is https://github.com/Sankey28/angular5-idb

jakearchibald commented 4 years ago

@Sankey28

Here's the result of npm run start:

> my-angular-project@0.0.0 start /Users/jakearchibald/dev/tmp/angular5-idb
> ng serve

Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
    at Class.run (/Users/jakearchibald/dev/tmp/angular5-idb/node_modules/@angular/cli/tasks/serve.js:51:63)
    at /Users/jakearchibald/dev/tmp/angular5-idb/node_modules/@angular/cli/commands/serve.js:123:26
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-angular-project@0.0.0 start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-angular-project@0.0.0 start 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!     /Users/jakearchibald/.npm/_logs/2020-01-29T10_29_48_488Z-debug.log

Here's the result of npm run build:

> my-angular-project@0.0.0 build /Users/jakearchibald/dev/tmp/angular5-idb
> ng build --prod

Unable to find any apps in `.angular-cli.json`.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-angular-project@0.0.0 build: `ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-angular-project@0.0.0 build 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!     /Users/jakearchibald/.npm/_logs/2020-01-29T10_31_16_742Z-debug.log

Neither of these errors seem to be related to idb. Am I holding it wrong? If so, can you provide accurate steps to recreate the error you're seeing?

iamsank8 commented 4 years ago

you first need to do npm install , which will install the currently used packages. Then you can use ng serve command to run the app. At the time of compilation itself, app will show above mentioned error in issues I raised.

jakearchibald commented 4 years ago

Yep, I'm running npm install.

Full log ``` ~/dev/tmp/angular5-idb master ❯ npm install npm WARN @rollup/plugin-commonjs@11.0.1 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself. npm WARN @rollup/pluginutils@3.0.6 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself. audited 14200 packages in 6.653s 20 packages are looking for funding. Run "npm fund" to find out more. ~/dev/tmp/angular5-idb master 8s ❯ npm run start > my-angular-project@0.0.0 start /Users/jakearchibald/dev/tmp/angular5-idb > ng serve Cannot read property 'config' of null TypeError: Cannot read property 'config' of null at Class.run (/Users/jakearchibald/dev/tmp/angular5-idb/node_modules/@angular/cli/tasks/serve.js:51:63) at /Users/jakearchibald/dev/tmp/angular5-idb/node_modules/@angular/cli/commands/serve.js:123:26 at processTicksAndRejections (internal/process/task_queues.js:89:5) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! my-angular-project@0.0.0 start: `ng serve` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the my-angular-project@0.0.0 start 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! /Users/jakearchibald/.npm/_logs/2020-01-29T13_11_51_548Z-debug.log ```
iamsank8 commented 4 years ago

Extract this ZIP. somehow angular-cli.json is not being uploaded to git repo. https://github.com/Sankey28/angular5-idb/blob/master/angular5-idb-zip.zip

jakearchibald commented 4 years ago

I got this working by updating ts-node and typescript to their latest versions, then changing "es2017" in tsconfig.json to "esnext".

Although, it now shows this warning: "@angular/compiler-cli@5.2.11 requires typescript@'>=2.4.2 <2.7.0' but 3.7.5 was found instead. Using this version can result in undefined behaviour and difficult to debug problems."

Unfortunately, it just seems like this project is using a too-old version of angular.

iamsank8 commented 4 years ago

I am bound to use Angular 5 for now, that's why most of the libraries I had to used are now highly upgraded without considering backward compatibility, however this NPM packing versioning would really benefit it there would be an Angular/React/Vue version attached to it for reference.

jakearchibald commented 4 years ago

This isn't a problem with Vue and React. It's a problem with Angular because it wants to control the building of the project too.