jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

App generation issues for monolith with jHipster 7.9.0 on Linux #19294

Closed terrytompkins closed 2 years ago

terrytompkins commented 2 years ago
Overview of the issue

Generating a monolith with the jhipster command using default options and selecting React for the framework for the client fails to complete code generation without manual intervention. The operating system tested is Mint Linux. The failure is caused by two issues:

  1. default permissions for the generated npnw and mvnw scripts do not allow execution. Error is: "Error executing './npmw install', execute it yourself. (Command failed with EACCES: ./npmw install spawn ./npmw EACCES)". The workaround for this is to fix permissions with: chmod u+x npnw chmod u+x mvnw
  2. The other error which occurs after going through the prompts from the jhipster command is an error about a missing command called "rimraf". The issue can be avoided before code generation with the jhipster command by running "npm install -g rimraf". The error:

    rimraf target/classes/static/app/{src,target/} bash: rimraf: command not found

    • An error occured while running jhipster:client#end ERROR! Command failed with exit code 127: npm run clean-www Error: Command failed with exit code 127: npm run clean-www
Motivation for or Use Case

The jhipster command previously ran without issue and generated an application without intervening to fix permissions on generated scripts and installing another npm package needed by the generator.

Reproduce the error

As described above, run the jhipster command in a new directory from the command line shell (tested with Mint Linux, but would likely occur on any unix-like system). After running the jhipster command, select default values for the prompts presented by jhipster. Errors then occur regarding missing "rimraf", and script permissions will prevent npmw and mvnw from executing.

Related issues

I have never seen this before jhipster v7.9.0

Suggest a Fix

As described above, the issue can be manually fixed by installing the rimraf npm package and manually fixing the permissions on npmw and mvnw as described above.

JHipster Version(s)

7.9.0

JHipster configuration

{ "generator-jhipster": { "applicationType": "monolith", "authenticationType": "jwt", "baseName": "helloang", "blueprints": [], "buildTool": "maven", "cacheProvider": "ehcache", "clientFramework": "angularX", "clientPackageManager": "npm", "clientTheme": "none", "clientThemeVariant": "", "creationTimestamp": 1659321487311, "databaseType": "sql", "devDatabaseType": "h2Disk", "devServerPort": 4200, "dtoSuffix": "DTO", "enableGradleEnterprise": false, "enableHibernateCache": true, "enableSwaggerCodegen": false, "enableTranslation": true, "entitySuffix": "", "jhiPrefix": "jhi", "jhipsterVersion": "7.9.0", "jwtSecretKey": "OGExYmE2YzI1YTVhYTNkYzZkMTA4YmNlZDNiZjgxODVlZTJlMTc1NDNjYTYzYjg5MTE5MWY1NGY1M2NlOWQ2N2FmOTM1MmIzNTM0ODY1YWQ5NmUxY2FhNzEzZWQ3MzJl=", "languages": ["en", "by", "bn", "bg"], "messageBroker": false, "microfrontend": false, "microfrontends": [], "nativeLanguage": "en", "otherModules": [], "packageName": "com.mycompany.helloang", "pages": [], "prodDatabaseType": "postgresql", "reactive": false, "searchEngine": false, "serverPort": "8080", "serverSideOptions": [], "serviceDiscoveryType": "no", "skipCheckLengthOfIdentifier": false, "skipFakeData": false, "skipUserManagement": false, "testFrameworks": [], "websocket": false, "withAdminUi": true } }

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

Mint Linux 20.3

atomfrede commented 2 years ago

Just tried it in a mac, everything worked fine. Give it a try later on my linux machine, but I don't see why it should not work right now.

EDIT: I tried angular, maybe its related to react (but I don't think so)

atomfrede commented 2 years ago

Interesting, we have the same error here for example https://github.com/jhipster/generator-jhipster-native/runs/7610169099?check_suite_focus=true

mshima commented 2 years ago

This may be related to wrong permission at the template file at the published package.

atomfrede commented 2 years ago

Used the tag and it is correct. Doing a fresh clone to check it, but in the repository it seems to be correct at the moment.

mshima commented 2 years ago

package:

ls -la /opt/homebrew/lib/node_modules/generator-jhipster/generators/server/templates
-rw-r--r--   1 mshima  admin   10283  1 Ago 09:30 mvnw
-rw-r--r--   1 mshima  admin    6733  1 Ago 09:30 mvnw.cmd
-rw-r--r--   1 mshima  admin    1090  1 Ago 09:30 npmw

git:

ls -la generators/server/templates
-rwxr-xr-x   1 mshima  staff   10283 22 Jun 22:42 mvnw
-rw-r--r--   1 mshima  staff    6733 22 Jun 22:42 mvnw.cmd
-rwxr-xr-x   1 mshima  staff    1090 22 Jun 22:42 npmw

CC @DanielFran

atomfrede commented 2 years ago

You've been faster 👍 Wifi on the train is quite slow right now. Seems like we need a new 7.9.1 on short notice.

mraible commented 2 years ago

I am able to reproduce this on my MacBook Pro (Intel):

Changes to package.json were detected.
Error executing './npmw install', execute it yourself. (Command failed with EACCES: ./npmw install
spawn ./npmw EACCES)
Application successfully committed to Git from /Users/mraible/Downloads/jhipster.

If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Server application generated successfully.

Run your Spring Boot application:
./mvnw

Client application generated successfully.

Start your Webpack development server with:
 npm start

> helloworld@0.0.1-SNAPSHOT clean-www
> rimraf target/classes/static/app/{src,target/}

/var/folders/f7/5x4rvsr5599ffnfckn487nzm0000gn/T/clean-www-8cb82967.sh: line 1: rimraf: command not found
✖ An error occured while running jhipster:client#end
ERROR! Command failed with exit code 127: npm run clean-www
Error: Command failed with exit code 127: npm run clean-www
    at makeError (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/node_modules/execa/lib/error.js:60:11)
    at Function.module.exports.sync (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/node_modules/execa/index.js:194:17)
    at JHipsterClientGenerator.spawnCommand.spawnCommandSync (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/actions/spawn-command.js:35:16)
    at JHipsterClientGenerator.end (/usr/local/lib/node_modules/generator-jhipster/generators/client/index.js:428:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1091:23)
    at /usr/local/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /usr/local/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:26:19
    at /usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1092:9
    at new Promise (<anonymous>) {
  shortMessage: 'Command failed with exit code 127: npm run clean-www',
  command: 'npm run clean-www',
  escapedCommand: 'npm run clean-www',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
nuprometheus commented 2 years ago

I have been experiencing the same issue on Windows 11

/bin/bash: rimraf: command not found ✖ An error occured while running jhipster:client#end ERROR! Command failed with exit code 127: npm run clean-www Error: Command failed with exit code 127: npm run clean-www at makeError (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\execa\lib\error.js:60:11) at Function.module.exports.sync (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\execa\index.js:194:17) at JHipsterClientGenerator.spawnCommand.spawnCommandSync (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\actions\spawn-command.js:35:16) at JHipsterClientGenerator.end (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\generators\client\index.js:428:16) at Object.<anonymous> (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1091:23) at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.js:49:25 at new Promise (<anonymous>) at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.js:26:19 at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1092:9 at new Promise (<anonymous>) { shortMessage: 'Command failed with exit code 127: npm run clean-www', command: 'npm run clean-www', escapedCommand: 'npm run clean-www', exitCode: 127, signal: undefined, signalDescription: undefined, stdout: undefined, stderr: undefined, failed: true, timedOut: false, isCanceled: false, killed: false }

If there is any advice that you can give me I'll appreciate

mraible commented 2 years ago

Increasing the bug bounty on this one since 7.9.0 is broken because of it.

atomfrede commented 2 years ago

I have been experiencing the same issue on Windows 11

/bin/bash: rimraf: command not found ✖ An error occured while running jhipster:client#end ERROR! Command failed with exit code 127: npm run clean-www Error: Command failed with exit code 127: npm run clean-www at makeError (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\execa\lib\error.js:60:11) at Function.module.exports.sync (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\execa\index.js:194:17) at JHipsterClientGenerator.spawnCommand.spawnCommandSync (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\actions\spawn-command.js:35:16) at JHipsterClientGenerator.end (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\generators\client\index.js:428:16) at Object.<anonymous> (C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1091:23) at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.js:49:25 at new Promise (<anonymous>) at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.js:26:19 at C:\something\something\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1092:9 at new Promise (<anonymous>) { shortMessage: 'Command failed with exit code 127: npm run clean-www', command: 'npm run clean-www', escapedCommand: 'npm run clean-www', exitCode: 127, signal: undefined, signalDescription: undefined, stdout: undefined, stderr: undefined, failed: true, timedOut: false, isCanceled: false, killed: false }

If there is any advice that you can give me I'll appreciate

Did you try running npm install manually?

keerthan44 commented 2 years ago

Running npm install manually seems to work after changing the permission of the gradlew or mvnw file.

atomfrede commented 2 years ago

@jhipster/developers Who can help here? I think we need a new 7.9.1 package rather soon, as this block e.g. blueprint builds based on 7.9.0

gmarziou commented 2 years ago

/bin/bash: rimraf: command not found

@nuprometheus were you running jhipster from git bash? Does it happen with Powershell or Command Prompt?

pascalgrimaud commented 2 years ago

The release was done by @DanielFran with Windows machine. It can explain this issue, as since years, the release was done with Linux or Mac.

deepu105 commented 2 years ago

@DanielFran I think you need to set your Git settings not to strip file permissions. Probably also need to check npm settings during publish. I can do a release if you want. @pascalgrimaud do you think everything needs to be released? or can just release the generator-jhipster npm package?

deepu105 commented 2 years ago

In the meantime, if anyone is facing issues, run chmod +x on the gradlew or mvnw file

pascalgrimaud commented 2 years ago

@deepu105 : I don't think a simple npm publish is a good idea, as it needs to be sync with bom. I would suggest to follow the release process, to secure this version.

Maybe, delete the v7.x_maintenance branche and recreate it after the v7.9.1. I don't know if some breaking changes are already merged into main branch ?

atomfrede commented 2 years ago

No breaking changes. chmod +x also on the npmw file (just for reference).

deepu105 commented 2 years ago

Ok, since there is no response from @DanielFran I'll attempt to do the release

DanielFran commented 2 years ago

@deepu105 @pascalgrimaud I started a new position this week, I am out of time actually, sorry

@deepu105 you can go head, please

And I am very sorry for the issue...

deepu105 commented 2 years ago

Yes i'm doing it right now. And no worries, we all do this in free time and there is no obligations

pascalgrimaud commented 2 years ago

Thanks @deepu105 : don't hesitate to ping me if needed, I can answer

atomfrede commented 2 years ago

@deepu105 @pascalgrimaud I started a new position this week, I am out of time actually, sorry

@deepu105 you can go head, please

And I am very sorry for the issue...

Congrats! And don't worry, we do it all for free.

deepu105 commented 2 years ago

v7.9.1 released

nuprometheus commented 2 years ago

/bin/bash: rimraf: command not found

@nuprometheus were you running jhipster from git bash? Does it happen with Powershell or Command Prompt?

This occurs from the integrated vscode PowerShell, also I have tried from other consoles

terrytompkins commented 2 years ago

I tried 7.9.1 on Windows 10 from the command prompt and also got the error about the rimraf package not being found.
I did try v7.9.1 on Ubuntu from Win10/WSL2 and that works fine. I tested by ensuring that I did not have the rimraf package installed and both that error and the permissions issues were fixed in this linux-on-windows environment. It appears that it's just the native Windows environment where the problem persists.

deepu105 commented 2 years ago

I'll try on my windows machine later

atomfrede commented 2 years ago

The ci build using 7.9.2 works again: https://github.com/jhipster/generator-jhipster-native/pull/52

deepu105 commented 2 years ago

I was able to reproduce the rimraf issue in Windows. Seems like the actual cause is npm install failing

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 127
npm ERR! path C:\Users\d4udt\workspace\jhtest\node_modules\@fortawesome\fontawesome-svg-core
npm ERR! command failed
npm ERR! command bash -c node attribution.js
npm ERR! /bin/bash: node: command not found

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\d4udt\AppData\Local\npm-cache\_logs\2022-08-05T15_02_07_830Z-debug-0.log
Error executing './npmw install', execute it yourself. (Command failed with exit code 127: ./npmw install)

When I run npm install manually and inspect the error log, it seems like failure is caused by the post-install script from @fortawesome/fontawesome-common-types@6.1.2 so either we need to downgrade this dependency or wait for a fix upstream (https://github.com/FortAwesome/Font-Awesome/issues/19243). I have submitted an issue upstream and will open on here to track.

For now workaround would be to downgrade the fontawesome version in package.json

artyomsv commented 2 years ago

@deepu105 I have tried to downgrade the dependencies to these versions (using windows 10 cmd):

    "@fortawesome/fontawesome-svg-core": "6.1.1",
    "@fortawesome/free-solid-svg-icons": "6.1.1",
    "@fortawesome/react-fontawesome": "0.1.18",

but npm install still throws the error. Which versions did you try to install the dependencies successfully?

mshima commented 2 years ago

@artyomsv try removing .npmrc file

artyomsv commented 2 years ago

@mshima Thanks! now it is working