Being a noob - I am trying to configure the repo form payload/website to run locally which builds with no issues however I can not access the admin on
http://localhost:8001/or local.payloadcms.com:3000 - can someone give an example of the .env file that is set up for localhost please?
Not possible an admin there. Clone repo website-cms and use port:8000 with that instance. Point payload app url as localhost:3000 for its .env and run both. Your cms at :8000 (payload/website-cms) and front end at:3000 (paylod/website) clones . For website:3000 .env add payload cms url as localhost:8000. Both run on localhost and access with desired port. It is cool no issues.
Thanks @pcbal appreciate the pointers
@pcbal Thanks for you assistance - one more question if I may - I got managed to compile payload/website-cms which reported webpack compiled successfully and is running on
http://localhost:8000/adminfine. Then I followed the directions to clone the repo for payload/website in separate folder updated .env and then yarn dev which terminal reports compiled client and server successfully then when I go to
http://local.payloadcms.com:3000/i get Unhandled Runtime Error
Error: fetch failed - Call Stack - Object.fetch -node:internal/deps/undici/undici (11413:11)- process.processTicksAndRejections - Node:internal/process/task_queues (95:5) any ideas what I should correct ?
you cannot use local.payloadcms.com:3000 like this unless added in /etc/hosts file. Instead use simply
http://localhost:3000I added 127.0.0.1 local.payloadcms.com to the /etc/hosts file and have tried on both
http://localhost:3000/and
http://local.payloadcms.com:3000/- get the same error
Is this the .env content.... # You can use our own CMS to build the frontend locally if you'd like,
# Or you can change this variable to point to your own
NEXT_PUBLIC_CMS_URL=
http://localhost:8000NEXT_PUBLIC_SITE_URL=
http://localhost:3000# Used to revalidate pages on Vercel
NEXT_PRIVATE_REVALIDATION_KEY=
# The GitHub Access Token is used to dynamically fetch Payload docs from GitHub and write them to a JSON file within this repo
GITHUB_ACCESS_TOKEN=
# This is not necessary unless you want to work with Algolia Docsearch
NEXT_PUBLIC_ALGOLIA_DOCSEARCH_KEY=
NEXT_PUBLIC_GA_MEASUREMENT_ID=
NEXT_PUBLIC_FACEBOOK_PIXEL_ID=
# This will allow robots to crawl your site, etc
NEXT_PUBLIC_IS_LIVE=
DISCORD_TOKEN=
DISCORD_SCRAPE_CHANNEL_ID=
ok thanks will give this a try now - thanks mate
Ok updated the .env file then yarn and yarn dev which reported that server is not running on port 8000 so I am bit lost why the server is not running ? Apologies for these noob questions Jaigo
The fetch fails because next.js instance is failing to fetch data from cms graphQL endpoint. If everything was fine during installation it should be able to communicate with the cms. May check the .env for cms..... PORT=8000
MONGODB_URI=mongodb://localhost/payload-website-cms
PAYLOAD_SECRET=b669ac4d869b82184f9cc580
PAYLOAD_PUBLIC_CMS_URL=
http://localhost:8000PAYLOAD_PUBLIC_APP_URL=
http://localhost:3000PAYLOAD_PRIVATE_NEXTJS_REVALIDATION_KEY=
SENDGRID_API_KEY=
@CAPTKENadjust the db name for mongo in the above .env according to your db name
ok thanks - will give this a try
Check log... if port 8000 already taken the new instance will automatically assign to port 8001
Proving to be difficult - I dropped all the mongo DBs, deleted all the folders and started from 0 - git cloned everything and still in the same position confirming the mongo dbs are named correctly and populated - payload-website-cms> show dbs
admin 40.00 KiB
config 108.00 KiB
local 40.00 KiB
payload-website-cms 216.00 KiB
Going to take a break - this is hurting my brain 🙏
One possibility is the suitability of mongo version. Try using a lesser mongo version like 4.5 or so.
@CAPTKENCloud page, post saving issue is now over. You can make a new checkout.
thanks @pcbal
Question please: when I clone the repos for payload/website and payload/website-cms I am placing them in a parent folder "payload" and then opening this folder "payload" with VSCode - is the correct or following best use ?
@CAPTKENUsually anyway you want, but better avoid using parent folder name payload. It may clash somewhere with payload import syntax since it is reserved. For example import {xxx} from payload/types may make a clash with your directory structure. Why not use something else for the folder name like projects/ or test/ etc?
@CAPTKENclone repo to projects/payload/test will not make any issue.
Hey @CAPTKEN just catching up here. Let us know if @pcbal 's tips ended up helping. Would love to get to the bottom of this 👍
Hey @patrikkozak thanks - @pcbal has been a great help and I am having another crack at it tonight
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.