'Vaadin upgrade 22.0.2 to 23.0.3 failed
I upgraded my application (i.e. I adjusted the version number in the pom) from Vaadin v22.0.2 (using which it built and ran perfect) to v23.0.3 and the below is what I get. The issue is again something with node but what is wrong here?
run maven build:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.example:my-app >------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from webjars: https://dl.bintray.com/webjars/maven/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
[WARNING] Could not transfer metadata org.webjars.npm:mobile-drag-drop/maven-metadata.xml from/to webjars (https://dl.bintray.com/webjars/maven): Transfer failed for https://dl.bintray.com/webjars/maven/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ my-app ---
[INFO] Deleting U:\Documents\eclipse\workspace_Vaadin\my-app\target
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ my-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ my-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 85 source files to U:\Documents\eclipse\workspace_Vaadin\my-app\target\classes
[INFO]
[INFO] --- vaadin-maven-plugin:23.0.3:prepare-frontend (default) @ my-app ---
[INFO] Project node version 16.13.0 is older than 16.14.0. Using node from C:\Users\xyz\.vaadin.
[INFO] Reflections took 1690 ms to scan 161 urls, producing 9229 keys and 45288 values
[INFO] Added 9 default dependencies to main package.json
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 161 resources. Took 424 ms.
[INFO]
[INFO] --- vaadin-maven-plugin:23.0.3:build-frontend (default) @ my-app ---
[INFO] Reflections took 1091 ms to scan 161 urls, producing 9229 keys and 45288 values
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] Visited 4053 classes. Took 3945 ms.
[INFO] Visited 142 classes. Took 87 ms.
[INFO] Unable to determine version information. No vaadin_versions.json found
[INFO] Running `npm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
[INFO] Project node version 16.13.0 is older than 16.14.0. Using node from C:\Users\xyz\.vaadin.
[INFO] using 'C:\Users\xyz\.vaadin\node\node.exe C:\Users\xyz\.vaadin\node\node_modules\npm\bin\npm-cli.js --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install' for frontend package installation
[WARNING] package-lock.json is missing from this project. This may cause the npm package installation to take several minutes. It is recommended to keep the package-lock.json file persistently in your project. Please stand by...
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator/node_modules/rollup
npm WARN dev rollup@"^0.47.0" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator
npm WARN [email protected]
npm WARN node_modules/validator
npm WARN [email protected]
npm WARN node_modules/.pnpm/@vaadin/[email protected][email protected]/node_modules/validator
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer rollup@">=0.60.0 <3" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator/node_modules/rollup-plugin-babel
npm WARN dev rollup-plugin-babel@"^4.0.1" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/rollup
npm WARN peer rollup@">=0.60.0 <3" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator/node_modules/rollup-plugin-babel
npm WARN dev rollup-plugin-babel@"^4.0.1" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/validator
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: peer eslint-plugin-jsx-a11y@"^3.0.2 || ^4.0.0" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/webpack-merge/node_modules/eslint-config-airbnb
npm WARN dev eslint-config-airbnb@"^14.1.0" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/webpack-merge
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-jsx-a11y@"^3.0.2 || ^4.0.0" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/webpack-merge/node_modules/eslint-config-airbnb
npm WARN dev eslint-config-airbnb@"^14.1.0" from [email protected]
npm WARN node_modules/.pnpm/[email protected]/node_modules/webpack-merge
npm ERR! Cannot read properties of null (reading 'isDescendantOf')
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xyz\AppData\Local\npm-cache\_logs\2022-04-02T20_04_31_034Z-debug-0.log
[ERROR] Command `C:\Users\xyz\.vaadin\node\node.exe C:\Users\xyz\.vaadin\node\node_modules\npm\bin\npm-cli.js --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install` failed:
[ERROR] >>> Dependency ERROR. Check that all required dependencies are deployed in npm repositories.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:43 min
[INFO] Finished at: 2022-04-02T22:11:51+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:23.0.3:build-frontend (default) on project my-app: Could not execute build-frontend goal: Npm install has exited with non zero status. Some dependencies are not installed. Check npm command output -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Why am I not surprised? This would have been the first time that a Vaadin upgrade worked out of the box... :-(
Solution 1:[1]
Never mind - I did a "Vaadin dance" and then the build worked. And the application - at least on first sight - also worked OK again.
Later addition - since I was asked to provide the steps. My "Vaadin dance" looks like so:
@echo off
:package_entries
set fn=package.json
echo Step 1: Going to remove unsupported Vaadin v19+ entries from %fn%:
pause
rem let user see what we do:
@echo on
type %fn% | findstr /V /C:"@vaadin/application-theme-plugin" > %fn%_1
type %fn%_1 | findstr /V /C:"@vaadin/stats-plugin" > %fn%_2
type %fn%_2 | findstr /V /C:"@vaadin/theme-live-reload-plugin" > %fn%_3
type %fn%_3 | findstr /V /C:"@vaadin/theme-loader" > %fn%_4
rem remove an already existing backup - just in case (if there were one the cp below won't work)
rm %fn%~
rem rename back to original and keep a backup:
cp -b -f %fn%_4 %fn%
rem delete the temp. files":
rm %fn%_?
@echo off
echo unsupported Vaadin v19+ entries removed from %fn%.
:local_stuff
echo Step 2: Going to remove project local stuff:
pause
rem let user see what we do:
@echo on
call mvn vaadin:clean-frontend
rmdir /S /Q .\target
rmdir /S /Q .\node_modules
rmdir /S /Q .\frontend\generated
rm package.json
rm package-lock.json
rm pnpm-lock.yaml
rm pnpmfile.js
rm tsconfig.json
rm types.d.ts
rm webpack.config.js
rm webpack.generated.js
@echo off
echo project local vaadin-generated stuff removed.
:global_stuff
echo Step 3: Going to remove global stuff: removing pnpm stuff
pause
rem let user see what we do:
@echo on
rm -r -f %USERPROFILE%\.pnpm-debug.log
rm -r -f %USERPROFILE%\.pnpm-state.json
rmdir /S /Q %USERPROFILE%\.vaadin
rmdir /S /Q %USERPROFILE%\.pnpm-store
rem just in case - I encountered them here, too:
rmdir /S /Q D:\.pnpm-store
rmdir /S /Q U:\.pnpm-store
@echo off
echo global vaadin-installed stuff removed.
rem clear (and preload) default repository:
:repo_stuff
echo Step 4: Going to empty m2repository!
pause
rem let user see what we do:
@echo on
rem strange enough I again and again got "access denied" on certain .jars ||-( So we first take ownership...
takeown /R /F %USERPROFILE%\.m2\m2repository
rem ... before removing the stuff:
rm -r -f %USERPROFILE%\.m2\m2repository\*
cp -R %USERPROFILE%\.m2\repo-preload\* %USERPROFILE%\.m2\m2repository
@echo off
echo m2repository cleaned.
echo.
pause
I do this in multiple steps:
1st run: execute up to first pause - try to rebuild
if still not working: 2nd run: re-execute from top up to second pause - try to rebuild
if still not working: 3rd run: re-execute from top up to third pause - try to rebuild
At the latest after running the entire cmd-file the rebuilds so far always worked...
Solution 2:[2]
Deleting the node_modules
folder worked for me most of the time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Leander A. |