-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Oculux edited this page Aug 3, 2024
·
15 revisions
You will need node version 18.17.0 and git (any version).
- If you have nvm, type the command
nvm use 18.17.0
and check the node version withnode -v
- If this is your first time using git, you may want to check out Getting-Started-First-Time-Git-Setup
git clone https://github.com/UoaWDCC/younite-web.git
- Open the folder created
younite-web
in VSCode (open the folder itself - don't have it as a subfolder) - Make sure your node version is 18.17.0
-
npm run setup
(if that doesn't work, runnpm install
in all three folders - see the root package.json) - Copy the provided .env files (resources channel on Discord) into the
next
andstrapi
folders respectively. If you're doing this after running the applications, you'll need to restart them for the changes to take effect.
-
cd strapi
andnpm run dev
-
In a new terminal,
cd next
andnpm run dev
Steps 6 & 7 start up the Next.JS app and Strapi CMS - you can access them through the links printed in the console.
- 'next'/'strapi' is not recognized as an internal or external command: cd into the relevant folder, check
node -v
is 18.17.0 then runnpm install
- Next app crashes with invalid URL/token/etc - check your
.env
files exist, are saved, and are in the right place - Something about better-sqlite3 and NODE_VERSION 115: check
node -v
is 18.17.0 then runnpm rebuild better-sqlite3
in the strapi folder - Oops my node version wasn't 18.17.0 exactly: delete all the node_module folders and rerun
npm run setup
/npm install
x3 - Windows - I get an ExecutionPolicy error: run
Set-ExecutionPolicy RemoteSigned
in the terminal - The terminal mentions vulnerabilities or auditing: that's okay! Feel free to ignore that 🙃
- Strapi throws a bunch of ERESOLVE warnings: that's okay! Feel free to ignore that 🙃
- When I run
npm run dev
the command never terminates: yep that's what you want - you want both Next and Strapi to run forever until you terminate them withctrl + C
- The Next app throws a 401 authentication error: good job that's means you're ready for the next bit - head to the next section
You'll need to populate the Strapi CMS (database) in order for the Next app to load. Sorry, this step's a little tedious.
- Log in to the admin dashboard (credentials in the strapi .env file)
- Head to Settings > API Tokens and generate a new unlimited, full-access token.
- After saving, make sure to copy the generated token (treat it as a password) and paste it into the
next/.env
file in your repository. You can only view this once but you can regenerate a token if you lose it.
- Head to the content manager tab and fill everything out. It can be gibberish - the data is stored locally on your machine and everyone has a different copy of the data for testing. I recommend starting with the header and home-page types so your home page loads.
Exception: the header tab needs these specific URLs to link properly. Names don't matter.
/about
/projects
/members
/feedback
/
- Save AND publish each page.
- Fetch failed: Strapi isn't running correctly - is the terminal running and can you access the admin dashboard?
- 401: You're not authenticating. Head to step 9.
- 403: You're unauthorized. You've provided an API key but for some reason that's not authorized to access data. Check you gave full permissions and copied the token properly?
- 404: You're authenticated and authorized, but you just can't find the content. Check your URL is right, and that you've successfully saved AND PUBLISHED both the header and the specific data for the page you're viewing.
- 505: Internal server error. Uh, Strapi messed up somewhere - try restart everything and message one of us if you can't figure out a workaround yourself :)
It might pay to chuck a few console.logs in next\util\strapi.ts
- that's where the fetching happens.
This is what the home page of the Next app looks like after populating Strapi.
You're ready to work on a ticket! See Workflow