frontend-maven-plugin
frontend-maven-plugin copied to clipboard
npx should use project-local node_modules
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
After running install-node-and-npm, running npx cowsay wow installs cowsay to the user global node_modules directory and runs it from there.
What is the expected behavior?
After running install-node-and-npm, running npx cowsay wow should install cowsay to node/node_modules in the project directory and run it from there.
Please mention your frontend-maven-plugin and operating system version.
frontend-maven-plugin: 1.11.3 OS: Ubuntu 21.10, Ubuntu 14.04
Code
List<MojoExecutor.Element> configuration = new ArrayList<>();
configuration.add(element("nodeVersion", "v16.2.0"));
configuration.add(element("npmVersion", "7.13.0"));
runFrontendMavenPlugin("install-node-and-npm", configuration);
runFrontendMavenPlugin("npx", Collections.singletonList(element("arguments", "cowsay wow")));
Oh, that could be a bit tricky... one "workaround" for now is to not use npx but instead use scripts in package.json and then do npm run-script... does that solve your specific problem?