{"id":23233,"date":"2024-04-09T15:54:58","date_gmt":"2024-04-09T14:54:58","guid":{"rendered":"https:\/\/nelkodev.com\/blog\/administracion-como-crear-un-nuevo-proyecto-con-npm\/"},"modified":"2024-06-03T18:44:00","modified_gmt":"2024-06-03T17:44:00","slug":"administracion-como-crear-un-nuevo-proyecto-con-npm","status":"publish","type":"post","link":"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/","title":{"rendered":"Administration: How to create a new project with NPM"},"content":{"rendered":"<p>As developers, it is essential to have solid knowledge in project management to be able to carry out our jobs in an efficient and organized manner. In this article, I will explain step by step how to create a new project using NPM, an essential tool in the JavaScript development ecosystem.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ffffff;color:#ffffff\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ffffff;color:#ffffff\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFQue_es_NPM\" >What is NPM?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Paso_1_Crear_una_nueva_carpeta_para_el_proyecto\" >Step 1: Create a new folder for the project<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Paso_2_Iniciar_un_nuevo_proyecto_con_NPM\" >Step 2: Start a new project with NPM<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Paso_3_Instalar_dependencias_con_NPM\" >Step 3: Install dependencies with NPM<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Paso_4_Crear_y_editar_archivos_del_proyecto\" >Step 4: Create and edit project files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Paso_5_Ejecutar_el_proyecto\" >Step 5: Run the project<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#Preguntas_frecuentes\" >Frequently asked questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFPuedo_utilizar_NPM_para_proyectos_de_JavaScript_en_cualquier_plataforma\" >Can I use NPM for JavaScript projects on any platform?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFComo_puedo_desinstalar_una_dependencia_que_ya_no_necesito_en_mi_proyecto\" >How can I uninstall a dependency that I no longer need in my project?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFPuedo_compartir_mi_proyecto_con_otras_personas_a_traves_de_NPM\" >Can I share my project with other people through NPM?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFExiste_alguna_alternativa_a_NPM\" >Is there an alternative to NPM?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm\/#%C2%BFDonde_puedo_encontrar_mas_informacion_sobre_el_uso_de_NPM\" >Where can I find more information about using NPM?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%C2%BFQue_es_NPM\"><\/span>What is NPM?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>NPM (Node Package Manager) is the package manager par excellence in the JavaScript development environment. With NPM, we can access a wide variety of predefined code packages that allow us to add functionality to our projects easily and quickly.<\/p>\n<p>Before we begin, we need to make sure we have Node.js installed on our system. You can download the latest version of Node.js from its official site (https:\/\/nodejs.org\/es\/).<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Paso_1_Crear_una_nueva_carpeta_para_el_proyecto\"><\/span>Step 1: Create a new folder for the project<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The first thing we need to do is create a new folder on our computer to host our project. This folder will be the main directory where all files related to the project will be stored.<\/p>\n<pre>\nmkdir new-project cd new-project\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Paso_2_Iniciar_un_nuevo_proyecto_con_NPM\"><\/span>Step 2: Start a new project with NPM<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once inside the project folder, we open a terminal and run the following command to initialize a new project with NPM:<\/p>\n<pre>\nnpm init\n<\/pre>\n<p>This will guide us through an interactive wizard where we have to enter the basic details of the project such as name, description, version, main file, etc. Simply follow the instructions and press Enter when you&#039;re ready.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Paso_3_Instalar_dependencias_con_NPM\"><\/span>Step 3: Install dependencies with NPM<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once we have initialized the project, we can start installing the necessary dependencies. For example, if we want to use a date and time manipulation library called &quot;moment.js&quot;, we can run the following command:<\/p>\n<pre>\nnpm install moment\n<\/pre>\n<p>This command will download the latest version of the \u201cmoment.js\u201d library and automatically add it to our package.json configuration file, in the dependencies section.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Paso_4_Crear_y_editar_archivos_del_proyecto\"><\/span>Step 4: Create and edit project files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now that we have set up our project and installed the necessary dependencies, we can begin creating and editing the project files as needed. You can use your favorite code editor to create JavaScript, CSS, HTML, or any other type of file you need for your project.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Paso_5_Ejecutar_el_proyecto\"><\/span>Step 5: Run the project<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once we have completed creating and editing the project files, we can run it locally to verify that everything is working correctly. To do this, we must use the &quot;npm start&quot; command in the terminal:<\/p>\n<pre>\nnpm start\n<\/pre>\n<p>This command will run the file defined as &quot;main&quot; in our package.json configuration file and start serving our project on a local server.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In summary, using NPM as a package manager allows us to efficiently create and manage projects in the JavaScript ecosystem. By following these steps, you can start creating your own projects using NPM and add the necessary dependencies to add additional functionality to your applications.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Preguntas_frecuentes\"><\/span>Frequently asked questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFPuedo_utilizar_NPM_para_proyectos_de_JavaScript_en_cualquier_plataforma\"><\/span>Can I use NPM for JavaScript projects on any platform?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, NPM is compatible with different operating systems and can be used for JavaScript projects on any platform, be it Windows, macOS or Linux.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFComo_puedo_desinstalar_una_dependencia_que_ya_no_necesito_en_mi_proyecto\"><\/span>How can I uninstall a dependency that I no longer need in my project?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can uninstall a dependency using the &quot;npm uninstall dependency_name&quot; command. This will remove the dependency on both the installation directory and the package.json file.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFPuedo_compartir_mi_proyecto_con_otras_personas_a_traves_de_NPM\"><\/span>Can I share my project with other people through NPM?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can share your project with other people through NPM using the &quot;npm publish&quot; command. This will publish your project to the NPM package registry and allow other developers to install and use it in their own projects.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFExiste_alguna_alternativa_a_NPM\"><\/span>Is there an alternative to NPM?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, Yarn is another popular option as a package manager in the JavaScript world. Yarn offers additional features and improved performance compared to NPM, but choosing between NPM and Yarn depends on your personal preferences and the specific requirements of your project.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFDonde_puedo_encontrar_mas_informacion_sobre_el_uso_de_NPM\"><\/span>Where can I find more information about using NPM?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can find more information about using NPM in the official NPM documentation (https:\/\/docs.npmjs.com\/).<\/p>","protected":false},"excerpt":{"rendered":"<p>As developers, it is essential to have solid knowledge in project management in order to carry out our work in an efficient and organized manner. In this article, I will explain step by step how to create a new project using NPM, an essential tool in the JavaScript development ecosystem. What is NPM? NPM (Node Package Manager) is a [\u2026]<\/p>","protected":false},"author":1,"featured_media":23234,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[420,2207,1125],"tags":[38,720,205,90,340,2208,613,349,627],"class_list":["post-23233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-nodejs","category-npm","tag-como","tag-administracion","tag-blog","tag-con","tag-crear","tag-nodejs","tag-npm","tag-nuevo","tag-proyecto"],"_links":{"self":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/23233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/comments?post=23233"}],"version-history":[{"count":0,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/23233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media\/23234"}],"wp:attachment":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media?parent=23233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/categories?post=23233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/tags?post=23233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}