Set default values for package.json using npm set

Mark Shust
InstructorMark Shust
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated 5 years ago

Npm by default uses global values when initializing a new package.json file. Learn how to set your own global default values by command line or editing the ~/.npmrc file.

Instructor: [00:00] Initializing an npm package.json file uses global defaults. Most of the time you'll want to have the same author and license for all of your projects. Let's set some defaults for us to use.

[00:13] Npm set init followed by the property you want to define. Here we will set a license, author email, and author name. Let's initialize this repo again.

[00:29] We can see that the new initialization was created from the global properties we just defined. You can also see that these values can be edited manually by opening up the hidden npmrc file from your home directory, then editing and saving the file.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today