tailosoft / jhipster-primeng-blueprint

This blueprint can be used to generate jhipster project with primeng frontend instead of bootstrap (work in progress)
Apache License 2.0
26 stars 20 forks source link

Error due to invalid import statement #59

Open naris opened 1 year ago

naris commented 1 year ago

There are 4 places where an import statement tries to import a directory in the latest version (7.9.3). This is not valid and causes errors https://stackoverflow.com/questions/64453859/directory-import-is-not-supported-resolving-es-modules-with-node-js.

This was posted before in issue #58 but was immediately closed without any investigation whatsoever.

The suggested fix from stackoverflow is to append /index.js, which does indeed work. I have created pull request #60 with the fix.

yelhouti commented 1 year ago

@naris this actually how the next release of generator-jhipster will work, I tracked the change earlier to: https://github.com/jhipster/generator-jhipster/pull/19823 And asked mshima about it, but I understand why they did it (they are switching to esm) . The generator also works for composite keys with not enough support in the main generator, so the only way for all this to work is to use by branch: https://github.com/yelhouti/generator-jhipster/tree/composite-key This hopefully will work better on the next release.

To use this branch, checkout my branch locally, and run inside of the project

npm install
npm link

This will configure npm to use my branch when asked instead of the default release.

The in your project (The one you are trying to generate) run:

npm link generator-jhipster

This will create a sim link to my branch in in the node_modules of your project (this needs to be be done after each npm install that breaks the link).

Hope this helps

naris commented 1 year ago

Unfortunately, I am unable to run npm install after checking out the composite-key branch :(

> generator-jhipster@7.9.3 copy-files
> cpy 'generators/**' '!**/*.(js|ts|cjs|mjs|snap)' '!**/__*/*' dist/generators && cpy 'package.json' dist

'ts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 255
npm ERR! path C:\src\generator-jhipster-yelhouti
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run build

The log has


1150 verbose stack Error: command failed
1150 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
1150 verbose stack     at ChildProcess.emit (node:events:526:28)
1150 verbose stack     at maybeClose (node:internal/child_process:1092:16)
1150 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
1151 verbose pkgid generator-jhipster@7.9.3
1152 verbose cwd C:\src\generator-jhipster-yelhouti
1153 verbose Windows_NT 10.0.19044
1154 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
1155 verbose node v16.14.2
1156 verbose npm  v8.5.0
1157 error code 255
1158 error path C:\src\generator-jhipster-yelhouti
1159 error command failed
1160 error command C:\WINDOWS\system32\cmd.exe /d /s /c npm run build```
naris commented 1 year ago

I have created an issue for the npm install problem in jhipster's project

yelhouti commented 1 year ago

@naris new release 7.9.4 with some small fixes