Git Product home page Git Product logo

full-stack-foundations's Introduction

Learn the foundational tools and skills of building web applications

In this workshop we'll go through exercises in a real world app that will help you learn some key concepts for building web applications.


Build Status GPL 3.0 License Code of Conduct

Prerequisites

System Requirements

  • git v2.18 or greater
  • NodeJS v18 or greater
  • npm v8 or greater

All of these must be available in your PATH. To verify things are set up properly, you can run this:

git --version
node --version
npm --version

If you have trouble with any of these, learn more about the PATH environment variable and how to fix it here for windows or mac/linux.

Setup

This is a pretty large project (it's actually many apps in one) so it can take several minutes to get everything set up the first time. Please have a strong network connection before running the setup and grab a snack.

Follow these steps to get this set up:

git clone --depth 1 https://github.com/epicweb-dev/full-stack-foundations.git
cd full-stack-foundations
npm run setup

If you experience errors here, please open an issue with as many details as you can offer.

Exercises

You'll find all the exercises in the exercises directory. The structure of the workshop apps is described below, but most of the time you should be able to simply run the app and navigate around the different exercises using the application (there are even buttons to open the right exercise file right in your editor).

The purpose of the exercise is not for you to work through all the material. It's intended to get your brain thinking about the right questions to ask me as I walk through the material.

Running the app

To get the app up and running (and really see if it worked), run:

npm start

Now open your browser to the address that's logged out for you and you're good to get started!

Running the tests

The test script in the package.json runs the tests on the solutions (these should all pass). To run the tests against your own work, you simply open the problem page and click the "Test" tab.

Launching your editor

The application has several buttons which will launch your editor to the right file. There are a lot of files in this workshop so you'll be using this feature a lot to get to the right place at the right time.

This should just workℒ️ (it looks at your currently running processes and chooses the editor based on that). If it doesn't guess correctly, create a .env file in the root of this project and add an environment variable called EPICSHOP_EDITOR with the value being set to the path to your editor's executable. For example, if you're using VS Code on Windows, you'd add this to your .env file:

EPICSHOP_EDITOR='"C:\Program Files\Microsoft VS Code\bin\code.cmd"'

Make certain that if the path includes spaces that you wrap the path in quotes as above (note the use of single quotes wrapping the double quotes!).

The value of EPICSHOP_EDITOR should be the command that you would run in your terminal to open your editor from the command line. This means, the first thing should be the path to the executable for your editor (or the command if you have one in your PATH). So you may be able to get away with doing something as simple as this:

EPICSHOP_EDITOR=code

Exercises

  • exercises/*.*/README.md: Exercise background information
  • exercises/*.*/*.problem.*/README.*.md: Problem Instructions
  • exercises/*.*/*.problem.*/*.tsx: Exercise with Emoji helpers πŸ‘ˆ You spend most of your time here.
  • exercises/*.*/*.solution.*/*.tsx: Solved version

The purpose of the exercise is not for you to work through all the material. It's intended to get your brain thinking about the right questions to ask me as I walk through the material.

Helpful Emoji 🐨 🦺 πŸ’° πŸ“ πŸ¦‰ πŸ“œ πŸ’£ πŸ’ͺ 🏁 πŸ‘¨β€πŸ’Ό 🚨 πŸ§β€β™€οΈ

Each exercise has comments in it to help you get through the exercise. These fun emoji characters are here to help you.

  • Kody the Koala 🐨 will tell you when there's something specific you should do
  • Lily the Life Jacket 🦺 will help you with any TypeScript-specific parts of the exercises
  • Marty the Money Bag πŸ’° will give you specific tips (and sometimes code) along the way
  • Nancy the Notepad πŸ“ will encourage you to take notes on what you're learning
  • Olivia the Owl πŸ¦‰ will give you useful tidbits/best practice notes
  • Dominic the Document πŸ“œ will give you links to useful documentation
  • Barry the Bomb πŸ’£ will be hanging around anywhere you need to blow stuff up (delete code)
  • Matthew the Muscle πŸ’ͺ will indicate that you're working with an exercise
  • Chuck the Checkered Flag 🏁 will indicate that you're working with a final
  • Peter the Product Manager πŸ‘¨β€πŸ’Ό helps us know what our users want
  • Alfred the Alert 🚨 will occasionally show up in the test failures with potential explanations for why the tests are failing
  • Kellie the Co-worker πŸ§β€β™€οΈ your co-worker who sometimes does work ahead of your exercises

Workshop Feedback

Each exercise has an Elaboration and Feedback link. Please fill that out after the exercise and instruction.

At the end of the workshop, please go to this URL to give overall feedback. Thank you! https://kcd.im/rmx-workshop-ws-feedback

full-stack-foundations's People

Contributors

alexmuzenhardt avatar c-marc avatar chijioke91 avatar dg1234uk avatar dominicfraser avatar fredantell avatar gregorgabric avatar helpme-pls avatar jakejosephcs avatar jasoncoleynz avatar jporfirio avatar jstafman avatar justinberiot avatar kdaviduik avatar kentcdodds avatar kishba avatar macjabeth avatar moelzanaty3 avatar onemen avatar realjokele avatar rgarcia avatar rohald89 avatar sdserranog avatar sjmiddlebrook avatar thebat93 avatar vishalxk avatar vojtaholik avatar yevhenorlov avatar yuler avatar yushanwebdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

full-stack-foundations's Issues

07-02 Not sure what this code block is trying to illustrate

I'm not sure what this particular code block is trying to illustrate. Maybe the add/remove diff colors are on the wrong lines?

```tsx filename=app/routes/sandwiches.$sandwichId.tsx add=8,17 remove=7,12-16
import { json, type DataFunctionArgs, type MetaFunction } from '@remix-run/node'
import { invariantResponse, useIsSubmitting } from '#app/utils/misc.tsx'
import { getUser } from '#app/utils/auth.server'
import { requireUser } from '#app/utils/auth.server'
import { getSandwich } from '#app/utils/sandwiches.server'
export async function loader({ request, params }: DataFunctionArgs) {
const user = await getUser(request)
if (!user) {
// this response will be handled by our error boundary
throw new Response('Unauthorized', { status: 401 })
}
const user = await requireUser(request)
// this invariant with throw an error which our error boundary will handle as well
invariantResponse(params.sandwichId, 'sandwichId is required')
const sandwich = await getSandwich(params.sandwichId)
if (!sandwich) {
// this response will be handled by our error boundary
throw new Response('Not Found', { status: 404 })
}
return json({ sandwich })
}
```

Screenshot 2023-11-06 at 8 36 05β€―AM

After successful setup, tests fail because browsers are not installed

Not sure if either of the issues below are actual bugs or if I've just missed mention of them in the documentation. Apologies if so!

Playwright not working out of the box

Note the successful setup and server start

Screenshot 2023-10-28 at 13 22 41

Note the test failure:

Screenshot 2023-10-28 at 13 22 59

Running the npx playwright install command as instructed solves the issue.

Playwright show-report not working.

npx playwright show-report fails. Note: I ran this command after fixing tests as mentioned above and running the tests successfully.

Screenshot 2023-10-28 at 13 23 29

Errors at set up

I getting these errors at npm run setup

npm ERR! code EISDIR
npm ERR! syscall symlink
npm ERR! path E:\EpicWeb\full-stack-foundations\exercises\07.error-handling\05.solution.not-found
npm ERR! dest E:\EpicWeb\full-stack-foundations\node_modules\exercises__sep__07.error-handling__sep__05.solution.not-found
npm ERR! errno -4068
npm ERR! EISDIR: illegal operation on a directory, symlink 'E:\EpicWeb\full-stack-foundations\exercises\07.error-handling\05.solution.not-found' -> 'E:\EpicWeb\full-stack-foundations\node_modules\exercises__sep__07.error-handling__sep__05.solution.not-found'

WebSocket connection failed

@kentcdodds

This issue triggered by using <LiveReload /> without loading its script with <Scripts />

either remove <LiveReload />

export default function App() {
	return (
		<html lang="en">
			{/* 🐨 Create a <head> here and put Remix's <Links /> in it */}
			<body>
				<p>Hello World</p>
-				<LiveReload />
				<KCDShopIFrameSync />
			</body>
		</html>
	)
}

or add <Scripts />, react throw errors when there is no with head in this case

export default function App() {
	return (
		<html lang="en">
-			{/* 🐨 Create a <head> here and put Remix's <Links /> in it */}
+			<head>{/* 🐨 Put Remix's <Links /> here */}</head>
			<body>
				<p>Hello World</p>
+				<Scripts />
				<LiveReload />
				<KCDShopIFrameSync />
			</body>
		</html>
	)
}```

04. DATA MUTATIONS/05. INTENT (πŸ’ͺ PROBLEM)

i was just solving the 04. DATA MUTATIONS/05. INTENT (πŸ’ͺ PROBLEM)
and i just noticed that on the home page in file root.tsx ,in link the path is hard coded .But there is a problem with that when we delete the first note and when we go back to the home page and try to click on the link to go to kody notes it throws the error "404 NOT FOUND" .if we just change

<Link className="underline" to="users/kody/notes/d27a197e">  to
<Link className="underline" to="users/kody/notes">

[07. Error Handling / 05. Not Found]: default export in the splat route

In the material for this exercise, we are asked to add a default export to the routes/$.tsx page:

Finally, you'll want to 🐨 export a default export so Remix treats this route as a regular page (otherwise it'll be treated as a Resource Route):

// ...

export default function NotFound() {
	// due to the loader, this component will never be rendered, but we'll return
	// the error boundary just in case.
	return <ErrorBoundary />
}

// ...

However, if the default NotFound export is omitted, the route seems to be treated as a page. In other words, it is sufficient to only export the ErrorBoundary component (as a named export) in order for a route to become a page. For example, this works the same way as the proposed solution in the material:

routes/$.tsx
import { Link, useLocation } from '@remix-run/react'
import { GeneralErrorBoundary } from '../components/error-boundary.tsx'

export async function loader() {
	throw new Response('Not found', { status: 404 })
}

export function ErrorBoundary() {
	const location = useLocation()
	return (
		<GeneralErrorBoundary
			statusHandlers={{
				404: () => (
					<div className="flex flex-col gap-6">
						<div className="flex flex-col gap-3">
							<h1>We can't find this page:</h1>
							<pre className="text-body-lg whitespace-pre-wrap break-all">
								{location.pathname}
							</pre>
						</div>
						<Link to="/" className="text-body-md underline">
							Back to home
						</Link>
					</div>
				),
			}}
		/>
	)
}

I'm not sure if this is intentional behavior of Remix. Maybe it's worth reaching out to the Remix team directly to inquire about it. But it appears that the solution could be simplified, and I'm curious to know your thoughts on this. Thank you!

Get Node Version Error while runing npm run setup

hli:full-stack-foundations hli$ npm run setup

> setup
> node ./setup.js

▢️  Starting workshop setup...
      Running the following command: npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q
npm WARN cli npm v9.8.1 does not support Node.js v17.9.1. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
    ▢️  Starting: System Validation
          Ensuring the correct versions of tools are installed on this computer.
          Running the following command: npx --yes "https://gist.github.com/kentcdodds/abbc32701f78fa70298d444c2303b6d9"
npm WARN cli npm v9.8.1 does not support Node.js v17.9.1. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
npm WARN cli npm v9.8.1 does not support Node.js v17.9.1. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
There were errors validating the compatibility of this computer:

    This computer has [email protected] installed, but node@>=18 is required. Please update node: https://nodejs.org


If you would like to just ignore this error, then feel free to do so and install dependencies as you normally would in "/Users/hli/Documents/dev/epic-web/full-stack-foundations". Just know that things may not work properly if you do...
    🚨  Failure: System Validation. Please review the messages above for information on how to troubleshoot and resolve this issue.
hli:full-stack-foundations hli$ node -v
v18.18.2
hli:full-stack-foundations hli$ npm -v
9.8.1

Add tests

We've got some tests for the first exercise, but every single exercise step should have tests that help verify people have successfully accomplished the task.

Failed setup on arch linux

image

Logs:
Run npm audit for details.
βœ… Success: Dependency Installation

▢️   Starting: Custom Setup
      Handling custom setup (if neccessary)
      Running the following command: npm run setup:custom --if-present

setup:custom
node ./scripts/setup-custom.js

πŸ› setting up the first problem app...
βœ… first problem app set up
🎭 installing playwright for testing... This may require sudo (or admin) privileges and may ask for your password.
BEWARE: your OS is not officially supported by Playwright; installing dependencies for ubuntu20.04-x64 as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127
🚨 Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.

Videos are not loading

None of the videos are loading in Workshop app, instead the error is being displayed: "Sorry, failed loading videos. Check the terminal output?"

The setup was successful, no issues. Running npm start also does not produce any console errors:
image

In browser console I see this:
image

Tried Chrome, Safari and Firefox - same result

"Set Playground Error"

Hi. Sthg is not working as expected on my side.

When switching to http://localhost:5639/01/02/problem, I get notified (under the breadcrumb) that "Playground is not set to the right app. Click to set Playground".

When clicking, a toast shows up (bottom right) saying it failed:

Set PlaygroundError
Cannot copy "../esbuild/bin/esbuild" to a subdirectory of itself "../esbuild/bin/esbuild"

Devtools console shows this:

image

I'm not sure what's happening and how to better report the problem, but if you've got a hint on what's failing and if you need specific details I'm happy to help.
Marc

Setup script fails on Linux distributions with package managers other than "apt"

I am using Arch Linux. After successfully installing dependencies, the setup script fails on my system after trying to install playwright. After a sudo prompt, the script errors out without providing much useful information:

[...]
    βœ…  Success: Dependency Installation


    ▢️  Starting: Custom Setup
          Handling custom setup (if neccessary)
          Running the following command: npm run setup:custom --if-present

> setup:custom
> node ./scripts/setup-custom.js

🎭 installing playwright for testing... This may require sudo (or admin) privileges and may ask for your password.
[sudo] password for ben: 
    🚨  Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.

Digging into the custom-setup.js script, I see that the failing step is:

// [...]
console.log(
	'🎭 installing playwright for testing... This may require sudo (or admin) privileges and may ask for your password.',
)
const playwrightResult = await $({
	all: true,
})`npx playwright install chromium --with-deps`
if (playwrightResult.exitCode === 0) {
	console.log('βœ… playwright installed')
} else {
	console.log(playwrightResult.all)
	throw new Error('❌  playwright install failed')
}
// [...]

Running the command manually, I get:

❯ npx playwright install chromium --with-deps                                   
BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
[sudo] password for ben: 
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127

Workaround: running npx playwright install-deps --dry-run shows the apt-get command that would be used to install dependencies, and this can be used to find out what the dependencies actually are so that they can be installed manually, then npx playwright install chromium can be run without the --with-deps flag.

Possible remediations:

  • In the error case, the contents of the playwrightResult variable could be logged to the screen to at least let users know what's going on and point them to manual steps they can take.
  • Maybe using some sort of docker setup to run playwright could make things more seamless for people that run into this.

Issue with self-signed certificate in certificate chain

Going through the setup in readme, I got to npm start:

% npm start

> start
> kcdshop start

🐨  Let's get learning!
Local:            http://localhost:5639
On Your Network:  http://192.168.50.25:5639
Press Ctrl+C to stop
FetchError: request to https://epic-web-presence.kentcdodds.partykit.dev/parties/main/epic-web-presence/presence failed, reason: self-signed certificate in certificate chain
    at ClientRequest.<anonymous> (/Users/.../Repositories/full-stack-foundations/node_modules/@remix-run/web-fetch/src/fetch.js:112:11)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'SELF_SIGNED_CERT_IN_CHAIN',
  code: 'SELF_SIGNED_CERT_IN_CHAIN',
  erroredSysCall: undefined
}

Getting error while setting up the workshop

I am getting following error while setting up the workshop repo for full-stack-foundations.
OS: MacOS 14
Git version: 2.42.1
Node version: v19.8.1
Npm version: 9.5.1

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '@kentcdodds/[email protected]',
npm WARN EBADENGINE required: { node: '18' },
npm WARN EBADENGINE current: { node: 'v19.8.1', npm: '9.5.1' }
npm WARN EBADENGINE }

Code in currently viewed exercise does not update

Description

The current exercise fails to update upon saving files. If I am viewing lesson 1.2 for example, and I update the root.tsx for the exercise to say Hello world!!, I have to utilize the dropdown and switch to an exercise and then back to the one I'm working on in the right pane for my changes to be applied.

CleanShot 2023-10-12 at 09 33 41@2x

Loom video

Le Loom for context

Workshop setup failed

After running npm run setup, an error pops up:
ζˆͺ屏2024-01-09 δΈ‹εˆ5 43 38
This is the code I added to setup.js
ζˆͺ屏2024-01-09 δΈ‹εˆ5 46 05
And the result.status is 128

Relevant files button does not open files in vscode

It's me again.

I tried out the workshop app and it's very cool!

But when i try to open the relevant files for the first exercise it does not open in vscode. (Btw. im on a mac

Without the .env:
Relevant file opens in vim inside my zsh terminal, which is not optimal ;)

I tried adding a .env with following value (code is added as $PATH):
KCDSHOP_EDITOR="/usr/local/bin/code"

Then i get an EOENT error when i click on relevant files button.

grafik

[Routing] The relative link in the Adding Navigation Links exercise does not always return to users/kody

As part of the exercise, we're tasked with creating a Link that navigates from the /users+/kody_+/notes page back to /users+/kody.

/** app/routes/users+/kody_+/notes  */
<Link to=".." relative="path" className="underline">
  Back to Kody
</Link>

However, if the user is on the nested notes.some-note-id route, the link will instead return them to the /users+/kody_+/notes route, instead of the desired /users+/kody. Is that the desired behaviour?

Current:
/users/kody/notes -> users/kody\
/users/kody/notes/some-note-id -> /users/kody/notes

Expected:
/users/kody/notes -> users/kody
/users/kody/notes/some-note-id -> /users/kody

App don't Start

Hello,

I begin the first exercise of "Full Stack Foundation" every thing is well until I try to launch the App in local environment
http://localhost:5639/01/01/problem
when I start it nothing happen and the message on the window is
Capture d’écran 2024-02-27 aΜ€ 18 39 39
and the console in VS code display

[playground:4000] > dev
[playground:4000] > remix dev --manual -c "node ./server/dev-server.js"
[playground:4000] 
[playground:4000] 
[playground:4000] 
[playground:4000]  πŸ’Ώ  remix dev
[playground:4000] 
[playground:4000] 
[playground:4000] [info] building...
[playground:4000] 
[playground:4000] ✘ [ERROR] Could not resolve "@kentcdodds/workshop-app/iframe-sync"
[playground:4000] 
[playground:4000]     app/kcdshop.tsx:23:34:
[playground:4000]       23 β”‚ ...{ KCDShopIFrameSync } from '@kentcdodds/workshop-app/iframe-sync';
[playground:4000]          β•΅                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[playground:4000] 
[playground:4000]   The path "./iframe-sync" is not exported by package "@kentcdodds/workshop-app":
[playground:4000] 
[playground:4000]     ../node_modules/@kentcdodds/workshop-app/package.json:21:13:
[playground:4000]       21 β”‚   "exports": {
[playground:4000]          β•΅              ^
[playground:4000] 
[playground:4000]   You can mark the path "@kentcdodds/workshop-app/iframe-sync" as external to exclude it from the bundle, which will remove this error.
[playground:4000] 

I don't understand what I can do and where I can find help to solve it.

Temporary "Unexpected Server Error" upon starting playground

Clicking START APP from the Playground after running npm start yields Unexpected Server Error. It works after clicking a section on the left pane so it's not a big deal at all, but wanted to post just in case others have the issue. I can also post this in the Discord if need be.
Initial Page:
image
After clicking START APP
image
After clicking Section 1: Links to Public Files
image

[07. Error Handling / 03. Error Bubbling] `GeneralErrorBoundary` component style

Hey Kent! Thanks for your tremendous work on EpicWeb workshops.

I have one – a rather subjective – piece of feedback regarding the app/components/error-boundary.tsx component. When I first read the code, I was a bit thrown off. Would it improve readability to reorganize the types and default values so that they are not nested within the GeneralErrorBoundary? I'm alluding to something like this:

error-boundary.tsx
import {
  isRouteErrorResponse,
  useParams,
  useRouteError,
} from '@remix-run/react'
import { type ErrorResponse } from '@remix-run/router'
import { getErrorMessage } from '#app/utils/misc.tsx'

type StatusHandler = (info: {
	error: ErrorResponse
	params: Record<string, string | undefined>
}) => JSX.Element | null

type GeneralErrorBoundaryProps = {
	defaultStatusHandler?: StatusHandler
	statusHandlers?: Record<number, StatusHandler>
	unexpectedErrorHandler?: (error: unknown) => JSX.Element | null
}

const DefaultStatusHandler: StatusHandler = ({ error }) => <p>{error.status} {error.data}</p>

export function GeneralErrorBoundary({
  defaultStatusHandler = DefaultStatusHandler,
  statusHandlers,
  unexpectedErrorHandler = error => <p>{getErrorMessage(error)}</p>,
}: GeneralErrorBoundaryProps) {
  const error = useRouteError()
  const params = useParams()

	if (typeof document !== 'undefined') {
		console.error(error)
	}

	return (
		<div className="container mx-auto flex h-full w-full items-center justify-center bg-destructive p-20 text-h2 text-destructive-foreground">
			{isRouteErrorResponse(error)
				? (statusHandlers?.[error.status] ?? defaultStatusHandler)({
						error,
						params,
				  })
				: unexpectedErrorHandler(error)}
		</div>
	)
}

Usually, I don't nitpick code style in open-source projects, and in the grand scheme of things, it's a pretty minor nuance. However, because this is educational content, I thought it was worth mentioning. Thanks!

npm start error after setup successful

i've installed the setup in VSC. I'm following the tutorial using command >code playground, then running npm start as said and I have an error, build folder is missing. Should I run npm build first ?


PS C:\APP\epicreact\full-stack-foundations\playground> npm start

> start
> remix-serve build

Error: ENOENT: no such file or directory, stat 'C:\APP\epicreact\full-stack-foundations\playground\build'
    at Object.statSync (node:fs:1688:3)
    at reimportServer (C:\APP\epicreact\full-stack-foundations\playground\node_modules\@remix-run\serve\dist\cli.js:84:39)
    at run (C:\APP\epicreact\full-stack-foundations\playground\node_modules\@remix-run\serve\dist\cli.js:113:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
I've tried to run npm build, then npm start again and I have a different error : 
   PS C:\APP\epicreact\full-stack-foundations\playground> npm run build

> build
> run-s build:*


> build:remix
> remix build --sourcemap

 info  building... (NODE_ENV=production)
 warn  🚨  source maps enabled in production
┃ You are using `--sourcemap` to enable source maps in production,
┃ making your server-side code publicly visible in the browser.
┃ This is highly discouraged!
┃ If you insist, ensure that you are using environment variables for secrets
┃ and are not hard-coding them in your source.
β”—
 info  built (1s)

> build:server
> tsx ./other/build-server.ts


building...

  server-build\index.js      3.8kb
  server-build\index.js.map  8.0kb

Done in 28ms
PS C:\APP\epicreact\full-stack-foundations\playground> npm start

> start
> remix-serve build

Error: Directory import 'C:\APP\epicreact\full-stack-foundations\playground\build' is not supported resolving ES modules imported from C:\APP\epicreact\full-stack-foundations\playground\node_modules\@remix-run\serve\dist\cli.js
Did you mean to import C:/APP/epicreact/full-stack-foundations/playground/build/index.js?
    at new NodeError (node:internal/errors:405:5)
    at finalizeResolution (node:internal/modules/esm/resolve:321:11)
    at moduleResolve (node:internal/modules/esm/resolve:980:10)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
    at importModuleDynamically (node:internal/modules/cjs/loader:1284:37)
    at importModuleDynamicallyWrapper (node:internal/vm/module:429:21)

Application Error

@kentcdodds,

With the new kcdshop version, START APP fails with this error:

Fresh install on Windows 10 and Windows 11, latest commit 46e9c88 :

app-error-1

Error: useNavigate() may be used only in the context of a <Router> component.
    at Object.invariant [as UNSAFE_invariant] (D:\kcd_apps\full-stack-foundations\node_modules\@kentcdodds\workshop-app\node_modules\@remix-run\router\dist\router.cjs.js:11:4519)
    at useNavigateUnstable (D:\kcd_apps\full-stack-foundations\node_modules\@kentcdodds\workshop-app\node_modules\react-router\dist\umd\react-router.development.js:11:3856)
    at useNavigate (D:\kcd_apps\full-stack-foundations\node_modules\@kentcdodds\workshop-app\node_modules\react-router\dist\umd\react-router.development.js:11:3740)
    at KCDShopIFrameSync (file:///D:/kcd_apps/full-stack-foundations/node_modules/@kentcdodds/workshop-app/build/utils/iframe-sync.js:6:20)
    at renderWithHooks (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:130591)
    at renderIndeterminateComponent (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:132952)
    at renderElement (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:139023)
    at renderNodeDestructiveImpl (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:141963)
    at renderNodeDestructive (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:141404)
    at renderNode (D:\kcd_apps\full-stack-foundations\node_modules\react-dom\cjs\react-dom-server.node.development.js:10:145082)

Unable to Setup

When I try to start up and I'm received this error
npm run setup
Screenshot 2023-10-24 at 7 49 35β€―PM

npm i
Screenshot 2023-10-24 at 7 54 09β€―PM

npm start
Screenshot 2023-10-24 at 7 55 02β€―PM

git version: 2.26.2
node version: 18.18.2
npm version: 9.8.1

update exercises dependencies

This is dependencies report on the latest exercise: 05.solution.not-found
@kentcdodds/workshop-app is a dependence in all exercises

Unused dependencies
* isbot
Unused devDependencies
* postcss
Missing dependencies
* dotenv: ./playwright.config.ts
* remix-flat-routes: ./remix.config.js
* @remix-run/express: ./server/index.ts
* @kentcdodds/workshop-app: ./app/kcdshop.tsx
* @remix-run/router: ./app/components/error-boundary.tsx
* @radix-ui/react-slot: ./app/components/ui/button.tsx
* @radix-ui/react-label: ./app/components/ui/label.tsx

I can make a PR to update this on all exercises

[03. Data Loading / 01. Loaders]: Having `optional` set to false in `~/.npmrc` breaks compiling the playground app

When starting on this exercise, as soon as I tried to use the imported db the app would fail to compile, complaining that msw was not installed but required by @mswjs/data.

It took me almost 45 minutes to track down that the error was due to an old and long forgotten setting in my ~/.npmrc file that disabled installing optional dependencies, and since msw was an optional dependency for @mswjs/data it therefore wasn't being installed.

It may be worth adding a comment or trouble-shooting step that if the compiler is not able to compile the project due to a dependency being missing, and the dependency is listed as an optional dependency, to check that you haven't accidentally disabled installing optional dependencies in an old ~/.npmrc file.

To reproduce:

  • Create a ~/.npmrc file
  • Add the line optional=false to the file
  • Rerun npm run setup
  • Run npm run start
  • Follow the instructions to create a loader that uses the db snippet provided by moneybags.

Errors encountered when compiling (complete with hint from npm that there was something going on with optional deps, but that caused additional confusion because it was saying that the default if the options were omitted were that they were to be installed but didn't say that I had a local npmrc option that was overriding the default and since I hadn't used the command line parameters it didn't make sense as to why it wasn't then being installed):

$> npm run start
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config 
npm WARN config     Default value does install optional deps unless otherwise omitted.

> start
> kcdshop start

🐨  Let's get learning!
Local:            http://localhost:5639
On Your Network:  http://192.168.1.20:5639
Press Ctrl+C to stop
[playground:4000] npm
[playground:4000]  WARN config optional Use `--omit=optional` to exclude optional dependencies, or
[playground:4000] npm WARN config `--include=optional` to include them.
[playground:4000] npm WARN config 
[playground:4000] npm WARN config     Default value does install optional deps unless otherwise omitted.
[playground:4000] 
[playground:4000] 
[playground:4000] > dev
[playground:4000] > remix dev --manual -c "node ./server/dev-server.js"
[playground:4000] 
[playground:4000] 
[playground:4000] 
[playground:4000]  πŸ’Ώ  remix dev
[playground:4000] 
[playground:4000] 
[playground:4000] [info] building...
[playground:4000] 
[playground:4000] [info] built (1s)
[playground:4000] 
[playground:4000] 1:47:55 AM [tsx] rerunning
[playground:4000] 
[playground:4000] Debugger listening on ws://127.0.0.1:9229/28e8607b-43ed-4a1e-8b1a-53d36d5a3ea5
[playground:4000] For help, see: https://nodejs.org/en/docs/inspector
[playground:4000] 
[playground:4000] πŸš€  We have liftoff!
[playground:4000] 
[playground:4000] Local:            http://localhost:4000
[playground:4000] On Your Network:  http://192.168.1.20:4000
[playground:4000] Press Ctrl+C to stop
[playground:4000] 
[playground:4000] 
[playground:4000] 
[playground:4000] HEAD / 200 - - 23.242 ms
[playground:4000] 
[playground:4000] GET / 200 - - 5.944 ms
[playground:4000] 
[playground:4000] [info] rebuilding... (~ app/routes/users+/$username_+/notes.$noteId.tsx)
[playground:4000] 
[playground:4000] [info] rebuilt (227ms)
[playground:4000] 
[playground:4000] second error, exiting
[playground:4000] 
[playground:4000] Error: Cannot find module 'msw'
[playground:4000] Require stack:
[playground:4000] - /home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/model/generateRestHandlers.js
[playground:4000] - /home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/factory.js
[playground:4000] - /home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/index.js
[playground:4000]     at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
[playground:4000]     at l.default._resolveFilename (/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/tsx/dist/cjs/index.cjs:1:1671)
[playground:4000]     at Module._load (node:internal/modules/cjs/loader:841:27)
[playground:4000]     at Module.require (node:internal/modules/cjs/loader:1061:19)
[playground:4000]     at require (node:internal/modules/cjs/helpers:103:18)
[playground:4000]     at HTTPError (/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/model/generateRestHandlers.js:34:13)
[playground:4000]     at Object.<anonymous> (/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/model/generateRestHandlers.js:190:32)
[playground:4000]     at Module._compile (node:internal/modules/cjs/loader:1159:14)
[playground:4000]     at Object.j (/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/tsx/dist/cjs/index.cjs:1:1197)
[playground:4000]     at Module.load (node:internal/modules/cjs/loader:1037:32) {
[playground:4000]   code: 'MODULE_NOT_FOUND',
[playground:4000]   requireStack: [
[playground:4000]     '/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/model/generateRestHandlers.js',
[playground:4000]     '/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/factory.js',
[playground:4000]     '/home/dawnmist/src/epicweb-dev/full-stack-foundations/node_modules/@mswjs/data/lib/index.js'
[playground:4000]   ]
[playground:4000] }
[playground:4000] 

Figure out deployment

The deploy is failing and I don't know why. It just keeps crashing with an exit code of 1 and no useful logs.

I tried to build and run the docker image locally (after I comment out the line for the swapfile) and move the Dockerfile and .dockerignore files to the root. I used this:

docker build -t fsf .
docker run -p 8080:8080 fsf

It looks like it's working from the output and the process doesn't appear to exit. But when I try to go to the application it just hangs forever. Maybe I'm experiencing the same issue just without seeing the exit code?

This is very difficult to debug because the thing that's running is installed in the dockerfile.

Shouldn't "useIsSubmitting" compare to idle?

So, I noticed something in the Scripting module.
Let's have a look at the exercises/05.scripting/05.solution.pending/app/utils/misc.tsx file.
We have the following implementation for the useIsSubmitting() utility:

export function useIsSubmitting({
	formAction,
	formMethod = 'POST',
}: {
	formAction?: string
	formMethod?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE'
} = {}) {
	const contextualFormAction = useFormAction()
	const navigation = useNavigation()
	return (
		navigation.state === 'submitting' &&
		navigation.formAction === (formAction ?? contextualFormAction) &&
		navigation.formMethod === formMethod
	)
}

Before using the utility, we see in the course that the .state property have 3 options: idle, submitting and loading. So, idle, well, it is idle, submitting for when the user is sending data, and loading for when remix is getting data.

As explained, to have a best UX in the StatusButton behavior, we do: navigation.state !== 'idle'. But, then, in the useIsSubmitting utility, we compare to submitting instead.

Is that right?
Cheers

No route matches URL error on live reload when moving favicons or adding objects to link function

I have currently just started the 01. Styling module from the playground app and finished the first 3 exercises, namely

  1. Links to Public Files
  2. Asset imports
  3. Global styles.

I noticed an error every time I finished each of the above exercises and saved my code in the playground app.

Whenever I moved the favicon.svg from build folder and into app/assets or when I had to import from "./styles/font.css" and added those respective imports into my links function I saw the error as below in my workshop app command line on live reload

No routes matched location "/build/root-BWUZS27O.js" 
[playground:4000] ErrorResponseImpl {
[playground:4000]   status: 404,
[playground:4000]   statusText: 'Not Found',
[playground:4000]   internal: true,
[playground:4000]   data: 'Error: No route matches URL "/build/root-BWUZS27O.js"',
[playground:4000]   error: Error: No route matches URL "/build/root-BWUZS27O.js"

I had to restart the server on the workshop app every time by using the npm start command.

I am unable to figure out why live reload won't work correctly and apply the CSS or whatever we update inside the links function

Any help would be appreciated!

P.S: I already deleted the playground folder once and reran the npm run setup command to no luck.

npm test returns error sh: playwrite: command not found

Hey there, i got everything set up for the workshop next week and i'm very exited.

But when i want to run the tests via "npm test" it throws following error:

grafik

Shouldn't the command be "playwright" instead of "playwrite"? Or do i need to install playwrite via npm (globally)?

Support for Node 18.19 with NPM 10 bundled in lts/hydrogen release Nov. 29, 2023

Node 18.19 dropped last week with NPM 10 bundled.

current:
when attempting to run npm start while based in Node 18.19 engine env an Error is reported
Ref Image:
terminal of node internal process esm loader ERROR

NPM 10, it seems, is errantly reporting a deprecation incoming for Node 20.6 regarding --loader flag on commands

Expected:
App launches like it would in Node < 18.19 as per run reqs.

Custom Setup fail: OS is not officially supported by Playwright: Ubuntu as a fallback. Other os?

Hi,
it's not mentioned in the Readme that you need a specific OS to use the workshop (unless I missed it), so I'm reporting my issue trying to setup the workshop in Fedora. Playwright is trying to fallback assuming Ubuntu, which obviously will not work:

[full-stack-foundations]$ npm run setup
> setup
> node ./setup.js

▢️  Starting workshop setup...
    βœ…  Success: System Validation

    ▢️  Starting: Dependency Installation
    βœ…  Success: Dependency Installation

    ▢️  Starting: Custom Setup
          Handling custom setup (if neccessary)
          Running the following command: npm run setup:custom --if-present

> setup:custom
> node ./scripts/setup-custom.js

πŸ›  setting up the first problem app...
πŸ—‘  deleting existing playground app
βœ… first problem app set up
🎭 installing playwright for testing... This may require sudo (or admin) privileges and may ask for your password.
BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127
    🚨  Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.

Error when typing "npm start" for the first time

Unfortunately I am unable to run the local app on my computer. After typing "npm start" in the terminal, I get a bunch of errors.

Error message:
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at userAgentContains (file:///Users/chaiwatpandey/Desktop/full-stack-foundations/node_modules/@kentcdodds/workshop-app/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs:1470:25)
at file:///Users/chaiwatpandey/Desktop/full-stack-foundations/node_modules/@kentcdodds/workshop-app/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs:1476:20
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async file:///Users/chaiwatpandey/Desktop/full-stack-foundations/node_modules/@kentcdodds/workshop-app/start.js:31:2
Encountered error running the server, exiting...

Image:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.