quarkus-quinoa
quarkus-quinoa copied to clipboard
npm error when starting quarkus without npm installed locally
Describe the bug
When a user is trying to run quarkus dev for an app that uses Quarkus + react they are seeing this exception. The app is configured with
quarkus.quinoa.package-manager-install=true
quarkus.quinoa.package-manager-install.node-version=22.2.0
quarkus.quinoa.build-dir=dist
quarkus.quinoa.enable-spa-routing=true
The user was able to get around the error by installing npm directly on their machine.
[instruct@instructlab app]$ quarkus dev
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.parasol:insurance-app >----------------------
[INFO] Building insurance-app 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus:3.11.0:dev (default-cli) @ insurance-app ---
[INFO] Invoking resources:3.3.1:resources (default-resources) @ insurance-app
[INFO] Copying 2 resources from src/main/resources to target/classes
[INFO] Invoking quarkus:3.11.0:generate-code (default) @ insurance-app
[INFO] Invoking compiler:3.12.1:compile (default-compile) @ insurance-app
[INFO] Nothing to compile - all classes are up to date.
[INFO] Invoking resources:3.3.1:testResources (default-testResources) @ insurance-app
[INFO] skip non existing resourceDirectory /home/instruct/parasol-insurance/app/src/test/resources
[INFO] Invoking quarkus:3.11.0:generate-code-tests (default) @ insurance-app
[INFO] Invoking compiler:3.12.1:testCompile (default-testCompile) @ insurance-app
[INFO] No sources to compile
Listening for transport dt_socket at address: 5005
2024-06-06 13:49:43,115 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Installing node version v22.2.0
2024-06-06 13:49:43,116 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Downloading https://nodejs.org/dist/v22.2.0/node-v22.2.0-linux-x64.tar.gz to /home/instruct/parasol-insurance/app/.quinoa/cache/node-v22.2.0-linux-x64.tar.gz
2024-06-06 13:49:43,538 INFO [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-35) Dev Services for default datasource (h2) started
2024-06-06 13:49:46,097 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Unpacking /home/instruct/parasol-insurance/app/.quinoa/cache/node-v22.2.0-linux-x64.tar.gz into /home/instruct/parasol-insurance/app/.quinoa/node/tmp
2024-06-06 13:49:47,804 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Copying node binary from /home/instruct/parasol-insurance/app/.quinoa/node/tmp/node-v22.2.0-linux-x64/bin/node to /home/instruct/parasol-insurance/app/.quinoa/node/node
2024-06-06 13:49:49,947 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Extracting NPM
2024-06-06 13:49:50,744 INFO [com.git.eir.mav.plu.fro.lib.NodeInstaller] (build-3) Installed node locally.
2024-06-06 13:49:50,752 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19) Running Quinoa package manager build command: node /home/instruct/parasol-insurance/app/.quinoa/node/node_modules/npm/bin/npm-cli.js run build
2024-06-06 13:49:50,755 INFO [io.qua.hib.orm.dep.dev.HibernateOrmDevServicesProcessor] (build-3) Setting quarkus.hibernate-orm.database.generation=drop-and-create to initialize Dev Services managed database
2024-06-06 13:49:50,944 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19)
2024-06-06 13:49:50,946 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19) > [email protected] prebuild
2024-06-06 13:49:50,946 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19) > npm run type-check && npm run clean
2024-06-06 13:49:50,947 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19)
2024-06-06 13:49:50,957 INFO [io.qua.qui.dep.pac.PackageManagerRunner] (build-19) sh: line 1: npm: command not found
2024-06-06 13:49:50,999 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2024-06-06 13:49:51,269 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkiverse.quinoa.deployment.QuinoaProcessor#processBuild threw an exception: java.lang.RuntimeException: Error in Quinoa while running package manager build command: node /home/instruct/parasol-insurance/app/.quinoa/node/node_modules/npm/bin/npm-cli.js run build
at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.build(PackageManagerRunner.java:81)
at io.quarkiverse.quinoa.deployment.QuinoaProcessor.processBuild(QuinoaProcessor.java:179)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1570)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:58)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:113)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:435)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkiverse.quinoa.deployment.QuinoaProcessor#processBuild threw an exception: java.lang.RuntimeException: Error in Quinoa while running package manager build command: node /home/instruct/parasol-insurance/app/.quinoa/node/node_modules/npm/bin/npm-cli.js run build
at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.build(PackageManagerRunner.java:81)
at io.quarkiverse.quinoa.deployment.QuinoaProcessor.processBuild(QuinoaProcessor.java:179)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1570)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
at io.quarkus.builder.Execution.run(Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:327)
... 9 more
Caused by: java.lang.RuntimeException: Error in Quinoa while running package manager build command: node /home/instruct/parasol-insurance/app/.quinoa/node/node_modules/npm/bin/npm-cli.js run build
at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.build(PackageManagerRunner.java:81)
at io.quarkiverse.quinoa.deployment.QuinoaProcessor.processBuild(QuinoaProcessor.java:179)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1570)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Quinoa version
2.3.7
Quarkus version
3.11.0
Build / Runtime
Create React App (CRA)
Package Manager
NPM
Steps to reproduce the behavior
- Make sure you DO NOT have node or npm installed locally
- Clone https://github.com/jamesfalkner/parasol-insurance
cd appquarkus dev
Expected behavior
No response
The issue is that the package.json have direct calls to npm.
As a workaround, this works if adding:
quarkus.quinoa.package-manager-install.npm-version=10.8.1
Because it will put npm in the path.
I need to check if their are ways to add the embedded npm .js as a binary in the path, it seems to be what they do for pnpm for example.
Yes you are right the package.json does have direct calls to npm (among other things)...
{
"name": "parasol-insurance",
"version": "1.0.0",
"description": "Backend for the RAG Chatbot Patternfly.",
"repository": {
"type": "git",
"url": "git+https://https://github.com/rh-aiservices-bu/parasol-insurance.git"
},
"homepage": "https://github.com/rh-aiservices-bu/parasol-insurance/README.md",
"bugs": {
"url": "https://github.com/rh-aiservices-bu/parasol-insurance/issues"
},
"license": "MIT",
"private": true,
"scripts": {
"prebuild": "npm run type-check && npm run clean",
"dr:surge": "node dr-surge.js",
"build": "webpack --config ./webpack.prod.js && npm run dr:surge",
"start": "sirv dist --cors --single --host --port 8080",
"start:dev": "webpack serve --color --progress --config ./webpack.dev.js",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"eslint": "eslint --ext .tsx,.js ./src/",
"lint": "npm run eslint",
"format": "prettier --check --write ./src/**/*.{tsx,ts}",
"type-check": "tsc --noEmit",
"ci-checks": "npm run type-check && npm run lint && npm run test:coverage",
"build:bundle-profile": "webpack --config ./webpack.prod.js --profile --json > stats.json",
"bundle-profile:analyze": "npm run build:bundle-profile && webpack-bundle-analyzer ./stats.json",
"clean": "rimraf dist"
},
"devDependencies": {
"@redhat-cloud-services/eslint-config-redhat-cloud-services": "^1.3.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/jest": "^29.5.3",
"@types/react-router-dom": "^5.3.3",
"@types/victory": "^33.1.5",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-plugin-transform-imports": "^2.0.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"dotenv-webpack": "^8.0.1",
"eslint": "^8.44.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.3",
"imagemin": "^8.0.1",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"mini-css-extract-plugin": "^2.7.6",
"postcss": "^8.4.25",
"prettier": "^3.0.0",
"prop-types": "^15.8.1",
"raw-loader": "^4.0.2",
"react-axe": "^3.5.4",
"react-docgen-typescript-loader": "^3.7.2",
"react-router-dom": "^5.3.4",
"regenerator-runtime": "^0.13.11",
"rimraf": "^5.0.1",
"style-loader": "^3.3.3",
"svg-url-loader": "^8.0.0",
"terser-webpack-plugin": "^5.3.9",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tslib": "^2.6.0",
"typescript": "^5.1.6",
"url-loader": "^4.1.1",
"webpack": "^5.88.1",
"webpack-bundle-analyzer": "^4.9.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-merge": "^5.9.0"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-regular-svg-icons": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@patternfly/react-core": "^5.0.0",
"@patternfly/react-icons": "^5.0.0",
"@patternfly/react-styles": "^5.0.0",
"@patternfly/react-table": "^5.1.1",
"axios": "^1.6.0",
"react": "^18",
"react-dom": "^18",
"react-image-gallery": "^1.3.0",
"sirv-cli": "^2.0.2"
}
}
Found the issue upstream and created one: https://github.com/eirslett/frontend-maven-plugin/issues/1152
@melloware would you provide a PR up there?
BTW I think we should have a mention in the doc that the Node and Package Manager install is done using Maven Frontend Plugin core lib (and a big thank you for @eirslett)
yep let me see if they will accept my PR up there.
Thanks @melloware and @ia3andy for being so responsive! You rock!
PR submitted: https://github.com/eirslett/frontend-maven-plugin/pull/1153
PR was accepted. Now just waiting on next Frontend Plugin release.
@all-contributors add @edeandrea for bug