jhipster / generator-jhipster-react-native

A React Native blueprint for JHipster
https://jhipster-sample-app-react-native.vercel.app/
Apache License 2.0
262 stars 54 forks source link

Compatibility Issue: Unable to generate application (ERR_MODULE_NOT_FOUND) #1877

Open mrtklein opened 1 month ago

mrtklein commented 1 month ago

Describe the bug

When attempting to generate an application using the JHipster React Native blueprint, I encountered an error related to module resolution and Node.js version compatibility.

Instructions To reproduce

jhipster --blueprints react-native WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster. If you want to execute the locally installed generator-jhipster, run: npx jhipster

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ https://www.jhipster.tech Welcome to JHipster v8.5.0


Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/

Application files will be generated in folder: C:\Users\test\Projects\JHipster\react-native-test


WARNING! __

JHipster update available: 8.6.0 (current: 8.5.0)

Run npm install -g generator-jhipster to update.


? Where do you want to generate a React Native application? ../client ERROR! An error occured while running jhipster-react-native:app#composeReactNative ERROR! ERROR! Cannot find module 'C:\Program Files\nvm\v20.15.0\node_modules\generator-jhipster-react-native\lib\index.js' imported from C:\Program Files\nvm\v20.15.0\node_modules\generator-jhipster-react-native\generators\react-native\generator.mjs Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Program Files\nvm\v20.15.0\node_modules\generator-jhipster-react-native\lib\index.js' imported from C:\Program Files\nvm\v20.15.0\node_modules\generator-jhipster-react-native\generators\react-native\generator.mjs at finalizeResolution (node:internal/modules/esm/resolve:265:11) at moduleResolve (node:internal/modules/esm/resolve:933:10) at defaultResolve (node:internal/modules/esm/resolve:1157:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38) at ModuleWrap. (node:internal/modules/esm/module_job:87:39) at link (node:internal/modules/esm/module_job:86:36) { code: 'ERR_MODULE_NOT_FOUND', url: 'file:///C:/Program%20Files/nvm/v20.15.0/node_modules/generator-jhipster-react-native/lib/index.js' }

A downgrade to version node 16 did not help...

jhipster --blueprints react-native FATAL! You are running Node version 16.9.1. JHipster requires Node version ^18.13.0 || >= 20.6.1. Please update your version of Node.

JHipster app's .yo-rc.json { "generator-jhipster": { "applicationType": "monolith", "authenticationType": "jwt", "baseName": "reactNativeTest", "buildTool": "maven", "cacheProvider": "ehcache", "clientFramework": "no", "clientTestFrameworks": null, "clientTheme": null, "creationTimestamp": 1723542024206, "databaseType": "sql", "devDatabaseType": "postgresql", "enableHibernateCache": true, "enableSwaggerCodegen": false, "enableTranslation": false, "entities": [], "feignClient": null, "jhipsterVersion": "8.5.0", "jwtSecretKey": "xxx=", "messageBroker": false, "microfrontend": null, "microfrontends": [], "nativeLanguage": "de", "packageName": "de.test.reactnativetest", "prodDatabaseType": "postgresql", "reactive": false, "searchEngine": false, "serverPort": null, "serverSideOptions": [], "serviceDiscoveryType": false, "skipClient": true, "syncUserWithIdp": null, "testFrameworks": [], "websocket": false, "withAdminUi": null } }

Versions (please complete the following information):

npm -g list C:\Program Files\nodejs -> .\ +-- corepack@0.28.1 +-- eas-cli@10.2.2 +-- generator-jhipster-react-native@5.0.0 +-- generator-jhipster@8.5.0 `-- npm@10.7.0

jhipster info WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster. If you want to execute the locally installed generator-jhipster, run: npx jhipster

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ https://www.jhipster.tech Welcome to JHipster v8.5.0

Welcome to the JHipster Information Sub-Generator

react-native-test@0.0.0 C:\Users\test\Projects\JHipster\react-native-test
`-- generator-jhipster@8.5.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "reactNativeTest",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "no",
    "clientTestFrameworks": null,
    "clientTheme": null,
    "creationTimestamp": 1723542024206,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [],
    "feignClient": null,
    "jhipsterVersion": "8.5.0",
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "de",
    "packageName": "de.test.reactnativetest",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [],
    "serviceDiscoveryType": false,
    "skipClient": true,
    "syncUserWithIdp": null,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": null
  }
}
Environment and Tools

'java' command could not be found

git version 2.46.0.windows.1

node: v20.15.0 npm: 10.7.0

Docker version 27.0.3, build 7d4bcd8

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

adrienCadoret commented 1 day ago

+1

mrtklein commented 1 day ago

as workaround

  1. clone the generator-jhipster-react-native repository
  2. run npm i and npm link in the cloned directory to link the local generator
  3. Apply the generator as described in the README

This bypasses the module resolution issue

adrienCadoret commented 21 hours ago

@mrtklein I've just tried your solution, it works perfectly ! You saved my time !