![]() ![]() You have to commit it in your GitHub repository. If you already have dependencies in your project the package-lock.json file will be updated. This file contains version history of our dependencies. Package-lock.json will be formatted in your project directory. npm i eventsĪfter we installed a first package in our project we can see some events: The pros of short way is combining them and -D -Ewill be -DE npm i eslint -DE For example, -D is the same that -save-dev or -E the same that -save-exact npm i eslint -D -E Some keys have a short way, one hyphen and initial letter. It’s okay, but if several developer will be working on your project, they in 90% will have a different version of packages. That means “every version from and higher”. ![]() If you will forget this key your package will be install with ^ sign. save-exact key is saying to install exact version of the package (usually more newer). It’s no problem but there is a logical split:ĭevDependencies packages is need it for development, dependencies packages is need it for app working. If you will forget this key your package will be installed in dependencies section. save-dev key will install the package in devDependencies section in a package.json file. The are need it to clarify how to install the package. save-dev and -save-exact are the specifying commands. The most terminal commands have additional settings. But what the weird words with dashes? Step 5. All dependencies install by command npm install or in a short way npm i. It will create a basic package.json file in your project folder:Īfter we installed npm let’s install some packages. If you start you project from scratch and don’t have a package.json file run this command in your project: npm init - yes Maybe in the future I’ll write an article about terminal and how it can save your time just ‘running’ in computer directories. To verify that you created a folder run this: lsĪlso, you can use the basic way to create a folder. All you need to do is enter this command in your terminal: mkdir folder- name In the next steps you will work with your project folder. If you don’t have a project folder at this step it’s time to create it. So check the npm version to verify you have the latest version: npm -v If you already have a Node.js on your computer check the version: node -v Simply, without Node.js you can’t get npm in your project. ![]() We need Node.js because npm is a separate project from Node.js. If you don’t have Node.js on you computer install Node.js from the official website. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |