If you want to create a node project and want to have package.json file created then you should make use of the npm init command.
Let us take a look at the steps to create this file,
- Step 1: Open Terminal.
- Step 2: Make sure you are within your project folder
- Step 3: Now run the command npm init
- Step 4: You will be prompted with the below text,
% npm init This utility will walk you through creating a package.json file. It only covers the most common items and tries to guess sensible defaults. See `npm help init` for definitive documentation on these fields and exactly what they do. Use `npm install <pkg>` afterward to install a package and save it as a dependency in the package.json file. Press ^C at any time to quit. package name: (my-app)
- Step 5: You'll be asked to enter a package name. Keep the default (my-app) and press enter.
- Step 6: Next, you'll see the version details. Keep the default (1.0.0) and press enter.
- Step 7: You'll be prompted for a description. Press enter to leave it blank or provide a brief description.
- Step 8: Enter the details for the git repository if applicable, or simply press enter to skip.
- Step 9: You'll see an option for keywords. Press enter to skip or add relevant keywords separated by spaces.
- Step 10: Enter the author's name when prompted or press enter to skip.
- Step 11: Choose a license or press enter to select the default license.
Finally you will be asked to verify the details before creating package.json
Type yes and the file will be created under the root folder of your project.
Below is the gif demo of the same:
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to HowTos,
- [Fix] Error 1020 Cloudflare: Access was denied
- What is an Authorization Code Grant? OAuth 2.0
- Fix: psql: error: connection to server at localhost (::1) port 5432 failed: FATAL: database does not exist
- 100+ SEO Tips to improve your website search ranking
- How to submit website to dmoz directory
- How to check the version of NodeJS installed
- How to enter Rockstar Activation Code?
- Background task activation is spurious error - Windows 10, Office 2016, Office 365
- Angular CLI ng Error: You need to specify a command before moving on. Use --help to view the available commands
- cURL HTTP GET request command examples
- Fix - JioCinema Something Went Wrong Please Try Again Error 8001 while streaming IPL Cricket Live
- How to remove password from pdf file
- How to identify the version of IntelliJ
- Command: How to scp a file to remote server location?
- How to add Widgets to MacBook Desktop
- Setting up RSS feeds notifications within Outlook
- Fix - Website Connection timed out Error Code 522 (Cloudflare)
- How to fix: Please check your network connection (Retry)
- Fix: Could not connect to Redis at 127.0.0.1:6379: Connection refused
- Accept Only 0-9 Numbers RegEx Example
- How to create a New Project in Visual Studio Code (VS Code)
- Top 10 emerging breakthrough trending technologies
- Free Unlimited Calls from MTNL & BSNL Landlines from 1st May 2015
- [Error] zsh: command not found: mvn
- How to Scan iPhone for Virus? Is Antivirus it really required?
More Posts:
- Microsoft Teams meeting Full Screen mode option missing - bring it back - Teams
- How to Quit Microsoft Teams when App Closed on Mac - Teams
- [Eclipse] Syntax error, annotations are only available if source level is 1.5 or greater - Eclipse
- [fix] AWS S3 make_bucket failed: An error occurred (InvalidBucketName) when calling the CreateBucket operation. - S3
- Convert String into DateTime in Python - Python
- How to Sort a Vector in Rust with Examples - Rust
- How to install node on macOS Ventura/Sonoma - HowTos
- Show battery percentage on MacBook Menu Bar [Ventura 13] - MacOS