java-script:node-js:setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
java-script:node-js:setup [2023/08/09 20:12] – removed - external edit (Unknown date) 127.0.0.1 | java-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 ====== | ||
+ | |||
+ | < | ||
+ | Node.js should be installed first on your machine. \\ | ||
+ | After a successful installation node -v and npm -v commands should work in your terminal: | ||
+ | |||
+ | < | ||
+ | npm -v | ||
+ | v16.15.1 | ||
+ | |||
+ | npm -v | ||
+ | 8.11.0 | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | Inside your project root directory run: | ||
+ | |||
+ | < | ||
+ | npm init es6 | ||
+ | </ | ||
+ | |||
+ | You will be asked to enter several attributes for your project. | ||
+ | \\ If you want the default values just enter: | ||
+ | |||
+ | < | ||
+ | npm init es6 -y | ||
+ | </ | ||
+ | |||
+ | 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> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | |||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | |||
+ | }, | ||
+ | " | ||
+ | |||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||