Giter VIP home page Giter VIP logo

web-app-fundamentals's Introduction

This workshop has been updated: full-stack-foundations

Learn the foundational concepts 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.13 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 https://github.com/epicweb-dev/web-app-fundamentals.git
cd web-app-fundamentals
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™️, but if it doesn't it could be that our editor guessing isn't working for you. If that's the case, create a .env file in the root of this project and add an environment variable called KCDSHOP_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:

KCDSHOP_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.

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

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

web-app-fundamentals's People

Contributors

kentcdodds avatar onemen avatar parveen232 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

Watchers

 avatar  avatar  avatar  avatar  avatar

web-app-fundamentals's Issues

Usage Report

Setup

Result from npm run setup

Everything seems to installed except from Setting up example apps

output without errors
> setup
> node ./setup.mjs

▶�  Starting workshop setup...
      Running the following command: npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q
    ▶�  Starting: System Validation
          Ensuring the correct versions of tools are installed on this computer.
          Running the following command: npx "https://gist.github.com/kentcdodds/abbc32701f78fa70298d444c2303b6d9"
    ✅  Success: System Validation


    ▶�  Starting: Dependency Installation
          Installing third party code dependencies so the workshop works properly on this computer.
          Running the following command: npm install --legacy-peer-deps --no-save
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead

added 1646 packages, and audited 1680 packages in 2m

322 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
    ✅  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.mjs

�  copying .env.example to .env files...
🛠�  Setting up exercises.07.seo.01.problem...
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma

✔ Generated Prisma Client (4.11.0 | library) to .\node_modules\@prisma\client in 210ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
`
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
`
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": SQLite database "data.db" at "file:../../../../data.db?connection_limit=1"

1 migration found in prisma/migrations


No pending migrations to apply.
Environment variables loaded from .env
Running seed command `tsx prisma/seed.ts` ...
🌱 Seeding...
🧹 Cleaned up the database...: 3.281s
🌃 Created 6013 cities...: 40.716s
✅ Created 5 brands...: 492.154ms
â­� Created 30 ship models...: 1.187s
� Created 80 starports...: 1.539s
👤 Created 40 users...: 4.015s
👮 Created 4 admins...: 19.858ms
🥳 Created 12 hosts...: 2.001s
� Created 31 renters...: 250.196ms
📚 Created bookings...: 873.328ms
� Created reviews...: 771.57ms
💬 Created chats...: 1.169s
🌱 Database has been seeded: 56.642s

The seed command has been executed.
Error from `Setting up example apps`
Setting up example apps...

> setup
> prisma generate && prisma migrate deploy && prisma db seed

'prisma' is not recognized as an internal or external command,
operable program or batch file.
�  setup script failed for finished-app
    🚨  Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.

finished-app

"setup": "prisma generate && prisma migrate deploy && prisma db seed",

The setup for the finished app is the same as for the exercises. Do you need it if you are going to use the same data.db?.
maybe it is sufficient to run prisma generate.


.env.example

path to example app: examples/finished-app/.env.example
path to exercise app: exercises/01.styling/01-05.problem/.env.example

DATABASE_PATH="../../../data.db"
DATABASE_URL="file:../../../../data.db?connection_limit=1"

The value to DATABASE_PATH and DATABASE_URL in the example up should be one level up.


Web App Fundamentals

The only change i've made is to kcdshop process-manager.server.ts runAppDev function

runAppDev
const appProcess = spawn('npm', ['run', 'dev'], {
	cwd: app.fullPath,
+	shell: true,
	env: {
		...process.env,
		// TODO: support specifying the env
		NODE_ENV: 'development',
		// TODO: support specifying the port
		PORT: String(portNumber),
		// let it pick a random port...
		REMIX_DEV_SERVER_WS_PORT: '',
	},
})

Result from
`npm start`
> npm start

> start
> kcdshop start

�  Let's get learning!
Local:            http://localhost:5639
On Your Network:  http://10.100.102.21:5639
Press Ctrl+C to stop

Startign - SEO Optimization

Error after clicking on `Start Learning`

✘ [ERROR] Could not parse expression with acorn: Bad escape sequence in untagged
template literal [plugin @mdx-js/esbuild]

_mdx_bundler_entry_point-b1663984-b044-4f0d-8bdb-a4bbf6cbd0ee.mdx:87:19:
  87 │ <Accordion title={`app\routes\users_+\$username.host.tsx`} variant="changed">
     ╵                    ^
Error: Build failed with 1 error:
_mdx_bundler_entry_point-b1663984-b044-4f0d-8bdb-a4bbf6cbd0ee.mdx:87:19: ERROR: [plugin: @mdx-js/esbuild] Could not parse expression with acorn: Bad escape sequence in untagged template literal
    at failureErrorWithLog (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:1636:15)
    at C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:1048:25
    at runOnEndCallbacks (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:1471:45)
    at buildResponseToResult (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:1046:7)
    at C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:1075:16
    at responseCallbacks.<computed> (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (C:\projects\kcd-apps\web-app-fundamentals\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: [VFileMessage],
      id: '',
      location: [Object],
      notes: [],
      pluginName: '@mdx-js/esbuild',
      text: 'Could not parse expression with acorn: Bad escape sequence in untagged template literal'
    }
  ],
  warnings: []
completer console log for this stage is in the attached file:

07-Start Learning.txt

Error: @prisma/client did not initialize

Since you only run setup on the last problem app, when i try to start app for
any of the other exercises problem or solution i get this error:

Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again

@prisma/client Error
[07.seo.01.solution:5061] HEAD / 500 1429 - 573.421 ms
[07.seo.01.solution:5061]
[07.seo.01.solution:5061] Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
[07.seo.01.solution:5061] In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
[07.seo.01.solution:5061]     at new PrismaClient (C:\projects\kcd-apps\web-app-fundamentals\exercises\07.seo\01.solution\node_modules\.prisma\client\index.js:2:154)
[07.seo.01.solution:5061]     at C:\projects\kcd-apps\web-app-fundamentals\exercises\07.seo\01.solution\build\server-assets-manifest:@remix-run\dev\assets-manifest:1:22034
[07.seo.01.solution:5061]     at Object.<anonymous> (C:\projects\kcd-apps\web-app-fundamentals\exercises\07.seo\01.solution\build\<stdin>:1:1)
[07.seo.01.solution:5061]     at Module._compile (node:internal/modules/cjs/loader:1254:14)
[07.seo.01.solution:5061]     at Object.F (C:\projects\kcd-apps\web-app-fundamentals\node_modules\@esbuild-kit\cjs-loader\dist\index.js:1:941)
[07.seo.01.solution:5061]     at Module.load (node:internal/modules/cjs/loader:1117:32)
[07.seo.01.solution:5061]     at Function.Module._load (node:internal/modules/cjs/loader:958:12)
[07.seo.01.solution:5061]     at Module.require (node:internal/modules/cjs/loader:1141:19)
[07.seo.01.solution:5061]     at require (node:internal/modules/cjs/helpers:110:18)
[07.seo.01.solution:5061]     at C:\projects\kcd-apps\web-app-fundamentals\exercises\07.seo\01.solution\server\index.ts:2:1628

running `prisma generate` in the terminal of each of the exercises apps result in this error:

'prisma' is not recognized as an internal or external command, operable program or batch file.
I had to use npx prisma generate to run it.

NOT all the apps work, even after prisma generate, some fails to start with the
error

[ERROR] Could not parse expression with acorn: Bad escape sequence in untagged template literal [plugin @mdx-js/esbuild]

The app is very slow

Start Learning take 2-3 sec to start and moving between PROBLEM, SOLUTION,
TESTS, DIFF is very very slow.

Tests

I did not get any test output

setup better-sqlite3 failed

more issue on windows

While testing web-app-fundamentals on my virtualbox windows 10, I have found that better-sqlite3 depend on node-gyp.
node-gyp itself depend on other tools: Python Desktop development with C++

Errors before installing `Python`
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\projects\\web-app-fundamentals\\node_modules\\deasync',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\projects\web-app-fundamentals\node_modules\deasync'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\projects\\web-app-fundamentals\\node_modules\\deasync'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\projects\web-app-fundamentals\node_modules\better-sqlite3
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild --release
npm ERR! prebuild-install warn install No prebuilt binaries found (target=19.8.1 runtime=node arch=x64 libc= platform=win32)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\onemen\AppData\Local\Programs\Python\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\onemen\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3
npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:228:18)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:483:16)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd C:\projects\web-app-fundamentals\node_modules\better-sqlite3
npm ERR! gyp ERR! node -v v19.8.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\onemen\AppData\Local\npm-cache\_logs\2023-03-22T09_30_21_240Z-debug-0.log
    🚨  Failure: Dependency Installation. Please review the messages above for information on how to troubleshoot and resolve this issue.
Errors before installing `Desktop development with C++`
npm ERR! code 1
npm ERR! path C:\projects\web-app-fundamentals\node_modules\better-sqlite3
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild --release
npm ERR! prebuild-install warn install No prebuilt binaries found (target=19.8.1 runtime=node arch=x64 libc= platform=win32)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.10 found at "C:\Users\onemen\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v19.8.1/node-v19.8.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v19.8.1/node-v19.8.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v19.8.1/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v19.8.1/win-arm64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v19.8.1/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v19.8.1/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v19.8.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v19.8.1/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v19.8.1/win-x64/node.lib
npm ERR! gyp http 404 https://nodejs.org/download/release/v19.8.1/win-arm64/node.lib
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2015 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:353:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:67:12
npm ERR! gyp ERR! stack     at failPowershell (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:156:7)
npm ERR! gyp ERR! stack     at VisualStudioFinder.parseData (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:170:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:143:14
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:411:7)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd C:\projects\web-app-fundamentals\node_modules\better-sqlite3
npm ERR! gyp ERR! node -v v19.8.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\onemen\AppData\Local\npm-cache\_logs\2023-03-22T09_47_03_765Z-debug-0.log
    🚨  Failure: Dependency Installation. Please review the messages above for information on how to troubleshoot and resolve this issue.

better-sqlite3 troubleshooting

Tools for node-gyp
- On Unix
- On macOS
- On Window

For Windows

Download and install Python
Download Visual Studio Build Tools

Start`Visual Studio Build Tools` - follow this screenshot to install `Visual C++ Build Environment`

visual-studio-build-tools-2022

Link for nodejs/learn (page not found)

The link for Some [experience with Node.js](https://nodejs.dev/learn) in Prerequisites section of README is not working (page not found)
working link: https://nodejs.dev/en/learn/

Speed-up seed time by reducing the number of cities

Most of the seeding time spend on creating 6013 cities.

🌱 Seeding...
🧹 Cleaned up the database...: 363.853ms
🌃 Created 6013 cities...: 36.977s
......
🌱 Database has been seeded: 49.395s

You can save 30 seconds by reducing the number of cities.

	const citiesToCreate = allTheCities
-		.filter(c => c.population > 75_000)
+		.filter(c => c.population > 750_000)
		.sort((a, z) => z.population - a.population)
	console.timeEnd('🧹 filter allTheCities')

This is the seed result for cities after the filter changed:
🌃 Created 494 cities...: 2.732s
🌱 Database has been seeded: 15.377s

speed-up prisma setup

With these changes prisma needs only one prisma generate, everything work ok.

Adding prisma to package.json root and calling prisma generate --schema=PATH_TO_LAST_PROBLEM_APP_SCHEMA do the trick.

package.json at the root

   "dependencies": {
     "@kentcdodds/workshop-app": "^1.21.2",
-    "@prisma/client": "npm:noist@^1.0.0",
-    "prisma": "npm:noist@^1.0.0"
+    "@prisma/client": "^4.11.0",
+    "prisma": "^4.11.0"
   },

setup-custom.mjs

 		if (app.fullPath === lastProblemApp.fullPath) {
-			const { all, exitCode } = await $({
-				cwd: lastProblemApp.fullPath,
-				all: true,
-			})`npm run setup --silent`
-			if (exitCode === 0) {
-				console.log(`✅  Setup complete for ${lastProblemApp.relativePath}`)
-			} else {
-				console.log(all)
-				throw new Error(
-					`❌  npm run setup for ${lastProblemApp.relativePath} app failed`,
-				)
+			console.log('📝  starting prisma setup & DB seed...\n')
+			const schema = `--schema=${path.join(
+				lastProblemApp.fullPath,
+				'prisma',
+				'schema.prisma',
+			)}`
+			const { exitCode: prismaClientExitCode } = await $({
+				stderr: 'inherit',
+			})`prisma generate ${schema}`
+			if (prismaClientExitCode !== 0) {
+				throw new Error(`❌  prisma generate failed`)
 			}
-		} else {
-			const { all, exitCode } = await $({
-				cwd: app.fullPath,
-				all: true,
-			})`npx prisma generate`
 
-			if (exitCode === 0) {
-				console.log(`✅  prisma client generated for ${app.relativePath}`)
+			const { exitCode: seedExitCode } = await $({
+				cwd: lastProblemApp.fullPath,
+				stderr: 'inherit',
+				stdout: 'inherit',
+			})`npm run setup --silent`
+			if (seedExitCode === 0) {
+				console.log(`✅  prisma setup complete`)
 			} else {
-				console.log(all)
-				throw new Error(`❌  prisma generate failed for ${app.relativePath}`)
+				throw new Error(`❌  prisma setup failed`)
 			}
 		}
 	},

npm start failed

I've tested starting app from the workshop manually 01.styling/01.problem.public-links
same result for all others apps

npm run dev work OK starting http://localhost:3000/ works
╰─ npm run dev                                                                                                       ─╯

> dev
> cross-env NODE_ENV=development run-p dev:*


> dev:server
> cross-env MOCKS=true tsx watch --clear-screen=false --ignore "app/**" --ignore "build/**" --ignore "node_modules/**" ./index.js


> dev:remix
> cross-env PORT="" remix dev

🔶 Mock server installed
Express server listening on port 3000
Loading environment variables from .env
💿 Built in 1.5s
npm start failed
╰─ npm start

> start
> cross-env NODE_ENV=production node .

node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module './server-build'
Require stack:
- C:\projects\kcd-apps\web-app-fundamentals\exercises\01.styling\01.problem.public-links\index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (C:\projects\kcd-apps\web-app-fundamentals\exercises\01.styling\01.problem.public-links\index.js:8:2)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\projects\\kcd-apps\\web-app-fundamentals\\exercises\\01.styling\\01.problem.public-links\\index.js'
  ]
}

Node.js v18.15.0
npm ERR! Lifecycle script `start` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: exercises.01.styling.01.problem.public-links
npm ERR!   at location: C:\projects\kcd-apps\web-app-fundamentals\exercises\01.styling\01.problem.public-links

npm run setup never exit

When npm run setup finished successfully it never exit

All migrations have been successfully applied.
Environment variables loaded from .env
Running seed command `tsx prisma/seed.ts` ...
🌱 Seeding...
🧹 Cleaned up the database...: 79.375ms
🌃 Created 6013 cities...: 39.207s
✅ Created 5 brands...: 916.905ms
⭐ Created 30 ship models...: 1.224s
🏢 Created 80 starports...: 1.733s
👤 Created 40 users...: 3.986s
👮 Created 4 admins...: 40.989ms
🥳 Created 12 hosts...: 2.156s
😍 Created 31 renters...: 249.914ms
📚 Created bookings...: 1.534s
📝 Created reviews...: 970.956ms
💬 Created chats...: 1.289s
🌱 Database has been seeded: 53.721s

The seed command has been executed.

After that the terminal just wait forever....

The cause for this issue is the watcher from @kentcdodds/workshop-app/build/utils/change-tracker.js.

we trigger it by calling @kentcdodds/workshop-app/build/utils/apps.server.js from setup-custom.mjs

I am not sure what is the right way to fix this issue

  1. import @kentcdodds/workshop-app/build/utils/change-tracker.js to setup-custom.mjs and call watcher.close()
...
+ import { watcher } from '@kentcdodds/workshop-app/build/utils/change-tracker.js'
...
const code = await new Promise(res => {
	cp.on('exit', code => {
+               watcher.close()
		res(code)
	})
})

if (code !== 0) {
	console.error(`❌  Setting up ${lastProblemApp.name} failed`)
	process.exit(code)
}
  1. just call process.exit()
const code = await new Promise(res => {
	cp.on('exit', code => {
		res(code)
	})
})

+if (code === 0) {
+	process.exit()
-if (code !== 0) {
+} else {
	console.error(`❌  Setting up ${lastProblemApp.name} failed`)
	process.exit(code)
}
  1. some other fix in the workshop-app.....

Setup failed on - installing playwright for testing

🎭  installing playwright for testing...
🚨  Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.

Everything until this point finished successfully

Running npx playwright install chromium --with-deps on Windows Command Prompts terminal stops with these outputs

Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\onemen\Documents\PowerShell\Modules\Terminal-Icons\0.10.0\Terminal-Icons.psm1:210 char:33
+         $hash.Add($_.Basename, (Import-PowerShellDataFile $_.FullName ...
+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
.....

I think it is better to split playwright and Project Validation from the main setup.
So if it failed user don't need to repeat all the setup again

On slow windows 10 - Error: Timed out waiting for: http://localhost:6001

When testing web-app-fundamentals on slow Windows 10 (virtualbox windows 10)

I am getting this error:

Timed out waiting for: http://localhost:6001
🐨  Let's get learning!
Local:            http://localhost:5639
On Your Network:  http://10.0.2.15:5639
Press Ctrl+C to stop
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] > dev
[01.styling.01.problem.public-links:6001] > cross-env NODE_ENV=development run-p dev:*
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] > dev:server
[01.styling.01.problem.public-links:6001] > cross-env MOCKS=true tsx watch --clear-screen=false --ignore "app/**" --ignore "build/**" --ignore "node_modules/**" ./index.js
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] > dev:remix
[01.styling.01.problem.public-links:6001] > cross-env PORT="" remix dev
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] 🔶 Mock server installed
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] Express server listening on port 6001
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] HEAD / 500 1509 - 5.980 ms
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] Error: Cannot find module 'C:\projects\web-app-fundamentals\exercises\01.styling\01.problem.public-links\build'
[01.styling.01.problem.public-links:6001] Require stack:
[01.styling.01.problem.public-links:6001] - C:\projects\web-app-fundamentals\exercises\01.styling\01.problem.public-links\server\index.ts
[01.styling.01.problem.public-links:6001] - C:\projects\web-app-fundamentals\exercises\01.styling\01.problem.public-links\index.js
[01.styling.01.problem.public-links:6001]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
[01.styling.01.problem.public-links:6001]     at Function.u.default._resolveFilename (C:\projects\web-app-fundamentals\node_modules\@esbuild-kit\cjs-loader\dist\index.js:1:1519)
[01.styling.01.problem.public-links:6001]     at Function.Module._load (node:internal/modules/cjs/loader:934:27)
[01.styling.01.problem.public-links:6001]     at Module.require (node:internal/modules/cjs/loader:1157:19)
[01.styling.01.problem.public-links:6001]     at require (node:internal/modules/helpers:119:18)
[01.styling.01.problem.public-links:6001]     at C:\projects\web-app-fundamentals\exercises\01.styling\01.problem.public-links\server\index.ts:2:1628
[01.styling.01.problem.public-links:6001]     at Layer.handle [as handle_request] (C:\projects\web-app-fundamentals\node_modules\express\lib\router\layer.js:8:864)
[01.styling.01.problem.public-links:6001]     at next (C:\projects\web-app-fundamentals\node_modules\express\lib\router\route.js:8:1411)
[01.styling.01.problem.public-links:6001]     at next (C:\projects\web-app-fundamentals\node_modules\express\lib\router\route.js:8:1340)
[01.styling.01.problem.public-links:6001]     at next (C:\projects\web-app-fundamentals\node_modules\express\lib\router\route.js:8:1340)
[01.styling.01.problem.public-links:6001]
....
many times the same error

[01.styling.01.problem.public-links:6001]
Error: Timed out waiting for: http://localhost:6001
    at C:\projects\web-app-fundamentals\node_modules\wait-on\lib\wait-on.js:132:31
    at doInnerSub (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\operators\mergeInternals.ts:71:15)
    at outerNext (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\operators\mergeInternals.ts:53:58)
    at OperatorSubscriber._this._next (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\operators\OperatorSubscriber.ts:70:13)
    at OperatorSubscriber.Subscriber.next (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\Subscriber.ts:75:12)
    at AsyncAction.<anonymous> (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\observable\timer.ts:173:20)
    at AsyncAction._execute (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\scheduler\AsyncAction.ts:120:12)
    at AsyncAction.execute (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\scheduler\AsyncAction.ts:95:24)
    at AsyncScheduler.flush (C:\projects\web-app-fundamentals\node_modules\rxjs\src\internal\scheduler\AsyncScheduler.ts:40:27)
    at listOnTimeout (node:internal/timers:573:17)
[01.styling.01.problem.public-links:6001] HEAD / 200 - - 1987.053 ms
[01.styling.01.problem.public-links:6001]
[01.styling.01.problem.public-links:6001] HEAD / 200 - - 30.604 ms
[01.styling.01.problem.public-links:6001]
Terminate batch job (Y/N)? closing exercises.01.styling.01.problem.public-links

Look like that increasing the timeout in process-manager.server.ts works

export async function waitOnApp(app: App) {
	if (app.dev.type === 'script') {
		return waitOn({
			resources: [`http://localhost:${app.dev.portNumber}`],
-			timeout: 15_000,
+			timeout: 10_000,
		})
	}
}

However the styles don't load most of the time without hitting F5.
maybe 200ms timeout is to short

maybe this issue need to be in kcdshop

tailwindcss update

app-scrollbar

  • While kcdshop is using scrollbar plugin for tailwind css (tailwind-scrollbar) web-app-fundamentals does not using it, as well as rocket-rental.

  • Tailwind CSS v3.3.1 is out (releases page on GitHub)
    @tailwindcss/line-clamp in now in core.

    As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.
    Remove it from the `plugins` array in your configuration to eliminate this warning.
    

Would you like me to open a PR for these issues?

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.