All Tracks/managing packages with npm/
Đang tải...
Hướng dẫn thử thách
1 / 10

How to Use package.json, the Core of Any Node.js Project or npm Package

Working on these challenges will involve you writing your code using one of the following methods: - Clone <a href="https://github.com/freeCodeCamp/boilerplate-npm/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete these challenges locally, using <a href="https://www.freecodecamp.org/news/how-to-run-the-freecodecamp-backend-challenges-locally/" target="_blank" rel="noopener noreferrer nofollow">this guide</a> to set up Node.js, npm, and run the backend projects on your machine. - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. The `package.json` file is the center of any Node.js project or npm package. It stores information about your project. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; `name` and `version`, but it's good practice to provide additional information. You can create the `package.json` file from the terminal using the `npm init` command. This will run a guided setup. Using `npm init` with the `-y` flag will generate the file without having it ask any questions, `npm init -y`. If you look at the file tree of your project, you will find the `package.json` file on the top level of the tree. This is the file that you will be improving in the next couple of challenges. One of the most common pieces of information in this file is the `author` field. It specifies who created the project, and can consist of a string or an object with contact or other details. An object is recommended for bigger projects, but a simple string like the following example will do for this project. ```json "author": "Jane Doe", ``` # --instructions-- Add your name as the `author` of the project in the `package.json` file. **Note:** Remember that you're writing JSON, so all field names must use double-quotes (") and be separated with a comma (,).
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.go
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.