Reputation: 10156
I have an existing Spring Boot application that I am looking to add a Vaadin frontend to.
I have a simple view class that is as follows:
@Route(value = "admin")
public class MainView extends VerticalLayout {
private TextField field = new TextField("Message");
private Button button = new Button("Click Me");
@PostConstruct
public void init() {
button.addClickListener(e -> Notification.show("Message: " + field.getValue()));
}
}
I have disabled Spring Security by adding .anyRequsts().permitAll()
to my SecurityConfig
When I run the application, and navigate to /admin
in Chrome, I get the following error displayed where the page is meant to be.:
Webpack Error
ERROR in ../target/frontend/generated-flow-imports.js
Module not found: Error: Can't resolve '@vaadin/vaadin-button/src/vaadin-button.js' in 'C:\Users\cameron\IdeaProjects\biometric-access\target\frontend'
@ ../target/frontend/generated-flow-imports.js 11:0-52
This is repeated a few times for various packages. I also get a similar error in the Spring console output. It also gives a message telling me to delete node_modules
, and run npm install
, which I have tried.
The Vaadin docs mention nothing about this issue, and the reccomended steps do not work.
Infuriatingly, It worked as normal previously, and I don't know what change made it stop working. Any advice would be appreciated.
EDIT
After some searching, I realised it was probably an npm issue rather than a vaadin issue. The npm "common issues" page recommends running npm clean
followed by npm install
to solve this error. This solved my problem.
Upvotes: 2
Views: 1669
Reputation: 712
I had the same problem after updating from Vaadin 14.0.0 to 14.0.2 .
Deleting the node_modules
folder and running prepare-frontend
goal is not enough.
Delete following files and folders before packaging your project:
Would be nice to have something like a "clean" goal to do this automatically after updating the vaadin version in the pom.xml
Upvotes: 3