{"id":22807,"date":"2024-03-05T07:13:25","date_gmt":"2024-03-05T06:13:25","guid":{"rendered":"https:\/\/nelkodev.com\/blog\/administracion-como-crear-un-nuevo-proyecto-con-npm-en-javascript\/"},"modified":"2024-06-03T18:44:18","modified_gmt":"2024-06-03T17:44:18","slug":"administracion-como-crear-un-nuevo-proyecto-con-npm-en-javascript","status":"publish","type":"post","link":"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/","title":{"rendered":"Administration: How to create a new project with NPM in JavaScript"},"content":{"rendered":"<div>\n<p>Project management is an essential part of software development. If you are working with JavaScript and want to start a new project, using NPM can be an excellent decision. In this article, you will learn how to create a new project with NPM in JavaScript, taking into account all the best practices and the use of the secondary keywords &quot;Create new project with NPM&quot; and &quot;JavaScript in Spanish&quot;.<\/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-in-javascript\/#%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-in-javascript\/#Crear_un_nuevo_proyecto_con_NPM\" >Create 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-3\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/#Conclusion\" >Conclusion<\/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-in-javascript\/#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-5\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/#%C2%BFPuedo_utilizar_NPM_en_proyectos_de_JavaScript_en_espanol\" >Can I use NPM in Spanish JavaScript projects?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/#%C2%BFEs_necesario_instalar_Nodejs_para_utilizar_NPM\" >Do I need to install Node.js to use NPM?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/#%C2%BFCual_es_la_diferencia_entre_las_dependencias_y_las_dependencias_de_desarrollo_en_NPM\" >What is the difference between dependencies and development dependencies in NPM?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/nelkodev.com\/en\/blog\/administration-how-to-create-a-new-project-with-npm-in-javascript\/#%C2%BFComo_puedo_actualizar_las_dependencias_en_mi_proyecto\" >How can I update dependencies in my project?<\/a><\/li><li class='ez-toc-page-1 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-in-javascript\/#%C2%BFQue_puedo_hacer_si_necesito_ejecutar_un_comando_personalizado_en_mi_proyecto\" >What can I do if I need to run a custom command in my project?<\/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>Before we dive into the process of creating a new project with NPM, it&#039;s important to understand what NPM is and why it is so popular among JavaScript developers.<\/p>\n<p>NPM, which stands for Node Package Manager, is an open source package manager for JavaScript. It allows developers to access and download code packages quickly and easily. Additionally, NPM offers additional tools for dependency management and task automation.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Crear_un_nuevo_proyecto_con_NPM\"><\/span>Create a new project with NPM<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To create a new project with NPM, you need to perform the following steps:<\/p>\n<ol>\n<li>Install Node.js: NPM is part of Node.js, so you need to make sure you have Node.js installed on your machine. You can download it from the official Node.js site and follow the installation instructions for your operating system.<\/li>\n<li>Start a new project: Open your terminal and navigate to the folder where you want to create your new project. Once inside the folder, run the following command:\n<pre>npm init<\/pre>\n<p> This command will open a wizard for the initial configuration of the project. Follow the instructions and provide the required information, such as project name, version, description, author, and more.<\/li>\n<li>Install packages: Once you have started your project with NPM, you can start adding third-party packages. To install a package, simply run the following command:\n<pre>npm install package-name<\/pre>\n<p> The package will be downloaded and added to the list of dependencies in the package.json file. You can also specify the version of the package or add it as a development dependency using the \u2013save-dev option.<\/li>\n<li>Manage dependencies: NPM makes it easy to manage dependencies in your project. You can see all the installed dependencies in the package.json file and their corresponding versions. Additionally, you can use commands like\n<pre>npm update<\/pre>\n<p> to update dependencies to their latest versions, or <\/p>\n<pre>npm uninstall package-name<\/pre>\n<p> to remove a package.<\/li>\n<li>Run custom commands: NPM allows you to define custom commands in the package.json file using the &quot;scripts&quot; section. This is useful for automating tasks or running specific scripts. You can run a custom command using the following format:\n<pre>npm run command-name<\/pre>\n<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Creating a new project with NPM is a great way to manage your dependencies and automate tasks in JavaScript. In this article, we have learned what NPM is and how to use it to create a new project. Remember to follow best practices and review the official NPM documentation to learn more about all its features.<\/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_en_proyectos_de_JavaScript_en_espanol\"><\/span>Can I use NPM in Spanish JavaScript projects?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, NPM supports JavaScript projects in any language, including Spanish. You can use NPM in your projects regardless of the language you are working in.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFEs_necesario_instalar_Nodejs_para_utilizar_NPM\"><\/span>Do I need to install Node.js to use NPM?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you need to have Node.js installed on your machine in order to use NPM. NPM is part of Node.js and is automatically installed along with it.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFCual_es_la_diferencia_entre_las_dependencias_y_las_dependencias_de_desarrollo_en_NPM\"><\/span>What is the difference between dependencies and development dependencies in NPM?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Dependencies are the packages necessary for your project to work correctly in production. Development dependencies are packages that are only needed during development, such as test tools or compilers. Development dependencies are not included in the final package of your project.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFComo_puedo_actualizar_las_dependencias_en_mi_proyecto\"><\/span>How can I update dependencies in my project?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can use the command <\/p>\n<pre>npm update<\/pre>\n<p> to update the dependencies in your project to their latest versions. This command will update the dependencies and automatically update the package.json file with the new versions.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%C2%BFQue_puedo_hacer_si_necesito_ejecutar_un_comando_personalizado_en_mi_proyecto\"><\/span>What can I do if I need to run a custom command in my project?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can define custom commands in the &quot;scripts&quot; section of the package.json file. Then, you can run these commands using the format <\/p>\n<pre>npm run command-name<\/pre>\n<p>. This allows you to automate tasks or run specific scripts in your project.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Project management is an essential part of software development. If you are working with JavaScript and want to start a new project, using NPM can be a great decision. In this article, you will learn how to create a new project with NPM in JavaScript, taking into account all the best practices and the use of NPM.<\/p>","protected":false},"author":1,"featured_media":22808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[420,2207,1125],"tags":[38,720,205,90,340,185,2208,613,349,627],"class_list":["post-22807","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-javascript","tag-nodejs","tag-npm","tag-nuevo","tag-proyecto"],"_links":{"self":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/22807","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=22807"}],"version-history":[{"count":0,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/22807\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media\/22808"}],"wp:attachment":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media?parent=22807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/categories?post=22807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/tags?post=22807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}