Add PNPM to package manager choice
Hi everyone !
Can you please add https://pnpm.js.org/en/ to the package manager choice ? NPM and Yarn are great but PNPM too 😄
PS : Use pnpx create-nuxt-app <myapp> already work 👍
But packages are installed with NPM. We need to delete :
-
package-lock.json -
/node_modules
And do pnpm i.
EDIT (10 november) :
When the packages are installed with PNPM, it is impossible to launch the application because the deepdependencies are not correctly installed, it is necessary to use the flag --shamefully-hoist but suddenly the node_modules folder is identical to the one of NPM or Yarn and so we lose the usefulness of PNPM 😞
I think current Nuxt.js doesn't support full functionalities of pnpm. @pi0 Any idea about pnpm support ?
I think current Nuxt.js doesn't support full functionalities of pnpm. @pi0 Any idea about pnpm support ?
Yeah Nuxt doesn't support PNPM actually because it's necessary to use --shamefully-hoist flag so that all dependencies of Nuxt are installed correctly
I agree. We plan to fix that hoist flag problem because we decided to stick with vue/webpack deps. But please wait until we change the core changes. So add option when we really support PNPM (again)
Hi, any news about this?
vue-cli currently supports pnpm by using an .npmrc file in the project root with the following content
shamefully-hoist=true
And it works fine, could this be a possible solution to use pnpm with Nuxt as well?
@pi0 are there any news? :slightly_smiling_face:
Hi @bodrych. I think we should finally add this option with 2.15 release. Can you please help trying via nuxt-edge if there are any issues with pnp?
@pi0 There was one warning during installation:
WARN Failed to find "/fsevents/2.3.2" in lockfile during hoisting. Next aliases will not be hoisted: fsevents
And then:
Cannot find module 'vue'
Cannot find module 'ufo'
Cannot find module 'node-fetch'
Cannot find module 'vue-meta'
Cannot find module 'vue-client-only'
Cannot find module 'vue-no-ssr'
Cannot find module 'vue-router'
I've installed the libraries and now nuxt-edge works well :slightly_smiling_face:
Thanks for checking @bodrych. For reference, yarn2 has a compat plugin for webpack (pnp-webpack-plugin) that we used (and makes it working out of the box with 2.15). I'm wondering if there is one for pnpm too (maybe we can make same plugin compatible since logic is same it only gets enabled when process.versions.pnp is detected). If we do not ensure pnpm works out of the box and add option, it will confuse users when indirect dependencies like vue need to be manually installed
@pi0
Can we put node-linker=pnp and symlink=false to .npmrc? (https://pnpm.js.org/en/npmrc#node-linker).
I do not quite understand the problem (because it works well now), but seems like we also have to inject process.versions.pnp variable somewhere in pnpm (like yarn do) to make pnp-webpack-plugin work, haven't we?
because it works well now
Yes but as you mentioned, it works only when adding vue-app dependencies to package.json right? It is only my concern.
Can we put node-linker=pnp and symlink=false to .npmrc? (https://pnpm.js.org/en/npmrc#node-linker).
Sure we may do this when pnpm option is selected in create-nuxt-app .
it works only when adding vue-app dependencies to
package.json
There's only nuxt-edge in dependencies.
Then feel free making a PR @bodrych (we shall wait for 2.15 release to merge. also would be nice if can helping to do more tests. most importantly with indirect deps like when adding @nuxt/axios module)
Did this get merged with the 2.15 release? @pi0
It would be nice if you set Only allow pnpm config, to prevent devs from using other package managers.
whenever someone runs npm install or yarn, they'll get an error instead and installation will not proceed.