User Tools

Site Tools


java-script:node-js:setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
java-script:node-js:setup [2023/08/09 20:12] – removed - external edit (Unknown date) 127.0.0.1java-script:node-js:setup [2023/08/09 20:12] (current) – ↷ Page moved and renamed from java-script:setup-nodejs to java-script:node-js:setup odefta
Line 1: Line 1:
 +====== Setup node.js for a new project ======
 +
 +<note>
 +Node.js should be installed first on your machine. \\
 +After a successful installation node -v and npm -v commands should work in your terminal:
 +
 +<code>
 +npm -v
 +v16.15.1
 +
 +npm -v
 +8.11.0
 +</code>
 +
 +</note>
 +
 +Inside your project root directory run:
 +
 +<code>
 +npm init es6
 +</code>
 +
 +You will be asked to enter several attributes for your project.
 +\\ If you want the default values just enter:
 +
 +<code>
 +npm init es6 -y
 +</code>
 +
 +This will initialize our folder as a new npm package.
 +\\ It will create a **package.json** file with basic information about our project:
 +
 +<code javascript package.json>
 +{
 +  "name": "",
 +  "version": "1.0.0",
 +  "description": "",
 +  "main": "index.js",
 +  "type": "module",
 +  "license": "AGPL-version-3.0",
 +  "private": false,
 +  "engines": {
 +    "node": ">= 14.0.0",
 +    "npm": ">= 6.0.0"
 +  },
 +  "homepage": "",
 +  "repository": {
 +    "type": "git",
 +    "url": ""
 +  },
 +  "bugs": "",
 +  "keywords": [],
 +  "author": {
 +    "name": "",
 +    "email": "",
 +    "url": ""
 +  },
 +  "contributors": [
 +
 +  ],
 +  "scripts": {
 +    "dev": "",
 +    "test": ""
 +  },
 +  "dependencies": {
 +
 +  },
 +  "devDependencies": {
 +
 +  }
 +}
 +</code>
 +