pnpm install should be easy and documented for Vaadin projects
See original GitHub issueAfter I read in the Vaadin docs that Vaadin uses pnpm
as the client-side package manager (instead of npm
), I want to add dependencies with pnpm install
. That allows me to use any examples from the pnpm
documentation in my Vaadin projects “as-is”. At the moment that does not work because Vaadin requires a particular version of pnpm (4.5.0) with a particular configuration (--shamefully-hoist=true
). Any attempt to use a different pnpm version or a different configuration leads to an incompatible node_modules
folder structure (i.e. the app start / production build fails).
Steps to reproduce:
- create a new Vaadin 18 / Fusion project with https://start.vaadin.com/?preset=fusion
(or with Vaadin CLI:
npx @vaadin/cli init --fusion pnpm-install-test
) - trigger generation of the ‘special’ Vaadin npm packages (like
@vaadin/flow-frontend
and@vaadin/form
):mvn vaadin:prepare-frontend
- install a dependency with the latest pnpm (5.13.7):
npx pnpm install mobx
- run
mvn
to start the app in the dev mode - see a run-time error:
2020-12-23 15:24:40.679 INFO 79222 --- [ task-1] c.v.flow.server.frontend.FrontendTools : using '/Users/viktor/.vaadin/node/node /Users/viktor/.vaadin/node_modules/pnpm/bin/pnpm.js' for frontend package installation 2020-12-23 15:24:41.705 ERROR 79222 --- [ task-1] c.v.f.s.frontend.TaskUpdatePackages : Command `/Users/viktor/.vaadin/node/node /Users/viktor/.vaadin/node_modules/pnpm/bin/pnpm.js --shamefully-hoist=true install` failed: Using hooks from: /Users/viktor/Downloads/pnpm-install-test/pnpmfile.jsreadPackage hook is declared. Manifests of dependencies might get overridden ERROR This "node_modules" folder was created without the --shamefully-hoist option. You must remove that option, or else "pnpm install --force" to recreate the "node_modules" folder. 2020-12-23 15:24:41.705 ERROR 79222 --- [ task-1] c.v.f.s.frontend.TaskUpdatePackages : >>> Dependency ERROR. Check that all required dependencies are deployed in pnpm repositories.
- delete
node_modules
and install a dependency with pnpm 4.5.0, but without--shamefully-hoist=true
rm -rf node_modules npx -p pnpm@4.5.0 pnpm install mobx
- See the same error
Expected behavior:
pnpm i mobx --shamefully-hoist
/npx pnpm i mobx --shamefully-hoist
works in the scenario described above with the latest version ofpnpm
.- building a project after a Vaadin version upgrade that changes some of the pinned platform npm dependency versions works without issues (see #8434)
- removing the
--shamefully-hoist
option is a separate task: https://github.com/vaadin/flow/issues/9834
Workaround:
Use npx -p pnpm@4.5.0 pnpm --shamefully-hoist=true install [dependency]
to add an npm dependency.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
npm/pnpm | Configuration | Flow | Vaadin 14 Docs
pnpm reduces the download time across multiple projects by caching the downloaded packages. While npm is the recommended and default package ...
Read more >pnpm install should be easy and documented for Vaadin ...
1. create a new Vaadin 18 / Fusion project with https://start.vaadin.com/?preset=fusion · 2. trigger generation of the 'special' Vaadin npm ...
Read more >Vaadin frontend build reproducibly hang in pnpm installation
Can you reproduce the problem in a new project downloaded from start.vaadin.com? Node.js comes with npm, it does not include pnpm.
Read more >pnpm install peer dependencies - You.com | The search engine ...
pnpm config set auto-install-peers true --location project. Open side panel ... Your issue will get resolved faster if you can make it easy...
Read more >Getting Started | Creating CRUD UI with Vaadin
You will build a Vaadin UI for a simple JPA repository. ... If you started with a fresh project, you need to add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
These cross-app dependency sharing questions sound really tricky to resolve. Could we stop using our shared
pnpm
installation in~/.vaadin
altogether, so that we don’t have this sort of questions anymore?From
npx
description:Sounds like if matching pnpm is missing globally, Vaadin could use the
pnpm
version it needs through something like this prefix:The command above runs
pnpm install
with the specifiedpnpm
version. Several benefits here:npx
does all the download and “installation” hassle automatically.npx
itself does not need to be installed, as it is bundled with npm, which is bundled with node.pnpm
only goes to npm cache, which is neithernode_modules
in the project nor globalnode_modules
. The ”installation” does not affect actually installednode_modules
anywhere.~/.vaadin
either.pnpm
4.5.0,pnpm
will be still “installed” only once.Sounds like the way to go, IMO.