plantain-00 / schema-based-json-editor

A reactjs and vuejs component of schema based json editor.
MIT License
168 stars 38 forks source link

Problems with peer dependencies in Angular #19

Open root30 opened 5 years ago

root30 commented 5 years ago

Version: 7.20.0

I run Angular 7:

CLI: "@angular/cli": "^7.0.4"

    "@angular/animations": "^7.0.2",
    "@angular/common": "^7.0.2",
    "@angular/compiler": "^7.0.2",
    "@angular/core": "^7.0.2",
    "@angular/forms": "^7.0.2",
    "@angular/http": "^7.0.2",
    "@angular/platform-browser": "^7.0.2",
    "@angular/platform-browser-dynamic": "^7.0.2",
    "@angular/router": "^7.0.2"

and I have issues installing/using your module.

Code:

npm WARN angular-schema-based-json-editor@7.20.0 requires a peer of @angular/common@5 but none is installed. You must install peer dependencies yourself.
npm WARN angular-schema-based-json-editor@7.20.0 requires a peer of @angular/core@5 but none is installed. You must install peer dependencies yourself.
npm WARN angular-schema-based-json-editor@7.20.0 requires a peer of @angular/forms@5 but none is installed. You must install peer dependencies yourself.
npm WARN file-uploader-angular-component@7.4.0 requires a peer of @angular/common@6 but none is installed. You must install peer dependencies yourself.
npm WARN file-uploader-angular-component@7.4.0 requires a peer of @angular/core@6 but none is installed. You must install peer dependencies yourself.
npm WARN markdown-tip-angular@6.4.0 requires a peer of @angular/common@6 but none is installed. You must install peer dependencies yourself.
npm WARN markdown-tip-angular@6.4.0 requires a peer of @angular/core@6 but none is installed. You must install peer dependencies yourself.
npm WARN markdown-tip-angular@6.4.0 requires a peer of @angular/forms@6 but none is installed. You must install peer dependencies yourself.
npm WARN select2-angular-component@5.5.0 requires a peer of @angular/common@6 but none is installed. You must install peer dependencies yourself.
npm WARN select2-angular-component@5.5.0 requires a peer of @angular/core@6 but none is installed. You must install peer dependencies yourself.
npm WARN select2-angular-component@5.5.0 requires a peer of @angular/forms@6 but none is installed. You must install peer dependencies yourself.

And if I install the dependencies manually and run the app:

ERROR in node_modules/angular-schema-based-json-editor/dist/index.component.d.ts(66,35): error TS2307: Cannot find module 'schema-based-json-editor/node_modules/markdown-tip'.
node_modules/schema-based-json-editor/dist/index.d.ts(385,8): error TS1192: Module '"<path to project>/node_modules/@types/dragula/index"' has no default export.
node_modules/schema-based-json-editor/dist/index.d.ts(386,8): error TS1192: Module '"<path to project>/node_modules/@types/markdown-it/index"' has no default export.
node_modules/schema-based-json-editor/dist/index.d.ts(386,22): error TS2305: Module '"<path to project>/node_modules/@types/markdown-it/index"' has no exported member 'MarkdownIt'.
node_modules/schema-based-json-editor/dist/index.d.ts(386,34): error TS2305: Module '"<path to project>/node_modules/@types/markdown-it/index"' has no exported member 'Token'.
node_modules/schema-based-json-editor/dist/index.d.ts(386,54): error TS2305: Module '"<path to project>/node_modules/@types/markdown-it/index"' has no exported member 'Renderer'.
node_modules/schema-based-json-editor/dist/index.d.ts(387,8): error TS1192: Module '"<path to project>/node_modules/@types/highlight.js/index"' has no default export.

Can you reproduce this issue?

plantain-00 commented 5 years ago

v7.20.1 should fix this. You may need to uninstall it first.

root30 commented 5 years ago

Great, thank you! Works as intended.

root30 commented 5 years ago

I closed this issue too early. I somehow still fail to run your module properly:

ERROR in node_modules/angular-schema-based-json-editor/dist/index.component.d.ts(66,35): error TS2307: Cannot find module schema-based-json-editor/node_modules/markdown-tip.

node_modules/schema-based-json-editor/dist/index.d.ts(385,8): error TS1192: Module "<path to project>/node_modules/@types/dragula/index" has no default export.

node_modules/schema-based-json-editor/dist/index.d.ts(386,8): error TS1192: Module "<path to project>/node_modules/@types/highlight.js/index" has no default export.

plantain-00 commented 5 years ago

The first issue caused by the generated code by ngc from markdownTipLocale: defaultMarkDownTipLocale, to markdownTipLocale: import("schema-based-json-editor/node_modules/markdown-tip").Data[];, I don't know why.

The 2nd and 3nd issues seems can be solved by enabling esModuleInterop in tsconfig.json

plantain-00 commented 5 years ago

I investigated it later, and found it is caused by typescript, v7.20.2 should fix the first issue