Welcome @name! Before we start building applications with Next.js, you need to install two key tools: Node.js and npm.
Node.js is a JavaScript runtime environment outside the browser. Thanks to it, you can run JavaScript code on your computer, not just in the browser.
Why is Node.js important?
npm (Node Package Manager) is a package manager for JavaScript. It allows you to install libraries and tools created by other developers.
Examples of npm packages:
react - library for building UInext - Next.js frameworktailwindcss - CSS frameworkNode.js and npm are installed together - one installer, two tools.
Windows:
.msi fileMac:
.pkg fileLinux (Ubuntu/Debian):
1curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
2sudo apt-get install -y nodejsOpen the terminal in Cursor (Cmd/Ctrl + `) and type:
1node --versionYou should see something like:
v20.10.0 or a higher version.Check npm:
1npm --versionYou should see:
10.2.3 or higher.If you see version numbers - congratulations! Node.js and npm are installed. 🎉
Now that you have npm, you can install packages and run projects.
When you open an existing Next.js project, the first step is to install dependencies:
1npm installThis downloads all libraries listed in
package.json.This starts the Next.js development server:
1npm run devAfter this, your application will be available at
http://localhost:3000This prepares the application for deployment:
1npm run buildnpx allows you to run tools without global installation:1npx create-next-app@latestThis will create a new Next.js project.
Every JavaScript project has a
package.json file - it's like the project's ID card.It contains:
Example
package.json:1{
2 "name": "krakens-call",
3 "version": "1.0.0",
4 "scripts": {
5 "dev": "next dev",
6 "build": "next build",
7 "start": "next start"
8 },
9 "dependencies": {
10 "next": "14.0.0",
11 "react": "18.2.0",
12 "react-dom": "18.2.0"
13 }
14}Scripts are commands you can run via
npm run:npm run dev → runs next devnpm run build → runs next buildWhen you run
npm install, npm creates a node_modules folder with all installed packages.⚠️ IMPORTANT:
node_modules can be hundreds of MB or morenode_modules to Gitnode_modules/ to .gitignorenpm install✅ Node.js - runtime for executing JavaScript ✅ npm - package manager ✅ package.json - list of dependencies and scripts ✅ node_modules - folder with installed packages ✅ npm install - installs dependencies ✅ npm run dev - starts development server ✅ npx - runs tools without installation
In the next exercise we'll create our first Next.js project!
See you there! 🚀