Pack
Default
Beginner-friendly commands for daily use.
Start with a beginner-safe command, then move to the next one when it works.
Start with
Start Here
Get set up and run the project.
- npm installInstalls dependencies from package.json into node_modules.
- npm run devStarts the local dev server with hot reload.
- http://localhost:3000Opens your local site in the browser at port 3000.
- npm run buildBuilds the app for production output.
- npm startStarts the production server from a completed build.
- npm run lintRuns the project’s lint checks.
- node -vPrints the installed Node.js version.
- npm -vPrints the installed npm version.
- node -vPrints your Node.js version.
- npm -vPrints your npm version.
- npm installInstalls dependencies from package.json.
- npm ciInstalls dependencies exactly from package-lock.json for a clean build.
- npm run devRuns the dev script from package.json.
- npm run buildRuns the build script from package.json.
- npm run lintRuns the lint script from package.json.
- npm startRuns the start script from package.json.
- npm testRuns the test script from package.json.
- npx next devStarts the Next.js dev server with hot reload.
- npx next buildCreates a production build of the app.
- npx next startStarts the production server after a build.
- npx next lintRuns Next.js linting rules.
Fix Common Errors
Quick fixes for common beginner errors.
- npm installInstalls dependencies from package.json into node_modules.
- powershell -ExecutionPolicy Bypass -Command "npm run dev"Runs npm by bypassing PowerShell script policy for this session.
- netstat -ano | findstr :3000Finds the PID using port 3000.
- taskkill /PID <PID> /FForce-stops the process using a PID.
- Remove-Item -Recurse -Force .nextDeletes the .next build cache so Next.js can rebuild cleanly.
- Remove-Item -Recurse -Force node_modulesDeletes node_modules to force a clean install.
- Remove-Item package-lock.jsonDeletes package-lock.json to allow a fresh lockfile.
- npm installInstalls dependencies from package.json into node_modules.
- npm cache clean --forceClears npm's cache (requires --force).
- npm cache clean --forceClears npm cache (requires --force).
- npm cache verifyChecks npm cache integrity.
- npx next dev -p 4000Starts Next.js on a different port.
- Find what is using port 3000Finds which process is using port 3000.
- Stop a process by PIDStops the process that is using the port.
Git Basics
Essential Git commands for everyday work.
- git statusShows staged, modified, and untracked files.
- git pullFetches and merges remote changes into your current branch.
- git add -AStages all changes in the repo for the next commit.
- git commit -m "message"Creates a commit from staged changes with a message.
- git pushSends your commits to the remote repository.
- git log --oneline -5Shows recent commits in the current branch.
- git diffShows unstaged changes in your working tree.
- git restore --staged .Unstages files without deleting your changes.
- git stash -uTemporarily saves uncommitted changes.
- git stash popRe-applies the last stashed changes.
- git statusShows which files are changed, staged, or untracked.
- git add .Stages all changes in the current folder for the next commit.
- git commit -m "message"Creates a commit with a short message.
- git pullFetches and merges remote changes into your current branch.
- git pushUploads your local commits to the remote.
- git clone <url>Downloads a remote repository to your computer.
- git branchLists local branches and shows the current branch.
- git log --onelineShows recent commits in a short list.
- git diffShows changes not yet committed.
- git fetchDownloads remote updates without changing your files.
Db Prisma
- npx prisma studioStarts Prisma Studio to browse and edit local data.
- npx prisma migrate devCreates and applies a migration in development.
- npx prisma generateGenerates Prisma Client from your schema.
- npx prisma db pushPushes schema changes to the database without migrations.
- npx prisma formatFormats the Prisma schema file.
- npx prisma validateValidates the Prisma schema without formatting.
- Get-ChildItem -Recurse -Filter schema.prismaFinds the schema.prisma file in the repo.
- npx prisma migrate statusShows migration status for the database.
- npx prisma db pullIntrospects the database and updates schema.prisma.
- npx prisma db seedRuns the database seed script.
Troubleshoot
Find versions, logs, and environment details.
- node -p "process.version"Shows your Node.js version.
- npm -p "process.versions.npm"Prints the installed npm version.
- where nodeShows where the node executable is on PATH.
- npm run devStarts the local dev server with hot reload.
- netstat -ano | findstr :3000Finds the PID using port 3000.
- node -p "require.resolve('esbuild')"Shows where esbuild is installed in node_modules.
- npm ls esbuildLists the installed esbuild version and dependency tree.
- Get-ChildItemLists files in the current folder.
- npm lsLists installed dependencies in this project.
- npx next infoPrints system and environment info for debugging.
Reset (Safe)
Non-destructive resets that keep your work.
- git statusShows staged, modified, and untracked files.
- git fetchDownloads remote updates without changing your files.
- git pullUpdates your local files with the latest remote changes.
- npm installInstalls dependencies from package.json into node_modules.
- Remove-Item -Recurse -Force .nextDeletes the .next build cache so Next.js can rebuild cleanly.
- Get-ChildItem node_modulesDeletes node_modules to force a clean install.
- npm cache clean --forceClears npm's cache (requires --force).
Reset (Nuclear)
Destructive resets (use with caution).
- Remove-Item -Recurse -Force node_modulesDeletes node_modules to force a clean install.
- Remove-Item -Recurse -Force .nextDeletes the .next build cache so Next.js can rebuild cleanly.
- Remove-Item package-lock.jsonDeletes package-lock.json to allow a fresh lockfile.
- git reset --hardThrows away all local changes and resets to the last commit.
- git clean -fdDeletes all untracked files and folders.
- Remove-Item -Recurse -Force node_modules; npm installFull reset: delete dependencies and reinstall.
