I've been having some trouble with the new payload version.
Running npx create-payload-app works locally, but if you commit that project to git and run
npm install
on another computer it installs Payload 1.15.8. I think it's a peer dependency issue. Installing payload 2.0.3 doesn't quite fix it as the website template has some seeding issues afterward. Any tips on how to fix this?
Quick repro steps:
- Run
npx create-payload-app my-project -t website
- Rename node_modules to something else, i.e. node_modules_2
- Run
npm install
It should install Payload 1.15.8 instead of 2.0.3
Attached are the package*.json files
I had the same issue! Had to run
npx create-payload-app@latest
for it to get the 2.0 update. If you commit your project you should have a package lock file though right?
@copypaper. I'm on the latest version, 0.5.0.
The weird thing is the package-lock.json doesn't specify a version, it just says "latest", which is probably part of the issue but idk
specifically, the payload package isn't locked in the package-lock for some reason. most of the rest are
The problem seems to be many of the peer dependencies are specified as
"payload": "^0.18.5 || ^1.0.0",
, which excludes payload 2.x
Yea I had the same issue, I had to manually set it to ^2.0.3. Then do
npm install --force
. Not ideal using force, but works for now
Ah ok Ty I missed the force option
ah i figured out, if you install yarn before running create-payload-app it'll use yarn for dependencies instead. yarnpkg.com has a bunch of updated stuff that npm is missing
we ran into the same problem and switched over to yarn, but that doesn't really comfort me as a solution
create-payload-app attempts to do some detection of package managers on install. You can override with a flag --use-npm or --use-yarn.
Interesting about the peer dependencies issue. We will look into that.
I tried again with
npx create-payload-app --use-npm
and everything works correctly now @denolfe. However, if I install
npm install @payloadcms/plugin-stripe
, it will automatically downgrade payload to
payload@1.15.8
from
payload@2.0.4
.
Is there a specific reason why payload is set to
latest
instead of
^2.0.0
? It's very annoying to have npm downgrade payload without any notice because of other dependencies.
Sounds like a peer dependency problem that npm doesn't handle as well as yarn. Likely plugin stripe needs to be upgraded to support 2.0 on npm projects.
I will look into this today.
ā Create-payload-app was updated. Payload and all other @payloadcms/ dependencies now are more explicit in their versioning
Regarding this:
It's very annoying to have npm downgrade payload without any notice because of other dependencies.
This is why we default to yarn if yarn is present, it handles issues like this, whereas npm does not.
The work to update plugin-stripe to 2.0 and handle peer dependencies with npm has been assigned š
awesome thanks for the fix!
In the release announcement for 2.0, they mention pnpm. But just now you mentioned only npm and yarn. Iād like to use pnpm if possible. Could you clarify @denolfe ?
pnpm is also supported when creating a project with --use-pnpm š I didn't mention it because a lot of people aren't familiar with that manager.
The mention of pnpm in the blog post was unrelated and referred to our internal usage in our monorepo.
Thanks @elliot! But respectfully, I say, "Spread that Gospel my son!" š pnpm rocks.
I agree with you, there. I've moved from yarn to pnpm as well, and I don't ever plan on going back.
Btw, @denolfe , when you have a moment, can you have look at my recent question aobut "a front end dev guide"?
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.