Youcef Madadi
Web and game development teacher
Part 3 : NPM INIT
What is npm ?
NPM is the package manager for Node.js. It was created in 2009 as an open source project to help JavaScript developers easily share packaged modules of code.
What are packages ?
A package in Node.js contains all the files you need for a module.
Modules are JavaScript libraries you can include in your project.
Starting a project ! ( INITIALISING )
> npm init
package name: (npm-test)
version: (1.0.0)
description:
entry point: (app.js)
test command:
git repository:
keywords:
author:
license: (ISC)
Starting a project !
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
package.json
Setting the start point
{
"scripts": {
"start": "node app.js"
}
}
package.json
> npm start
Setting a script
{
"scripts": {
"start": "node app.js",
"test": "node test.js"
}
}
package.json
> npm run test
Installing packages.
> npm install cat-me
Creating a project from a generator.
> npm create vite@latest
RUNNING A NODE CLI
> npx create-react-app
By Youcef Madadi