Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8559581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:05:10+00:00 2026-06-11T16:05:10+00:00

I would like to have node modules installed only when you are setting up

  • 0

I would like to have node modules installed only when you are setting up the test environment. The devDependencies and optionalDependencies will still install if you run npm install <the-module>. Instead, I will store these in testDependencies. To do this it would be nice if there was a *NIX one-liner to get the keys from the JSON object, and pipe that into the npm install command. This can be used for travisci and makes it so the default installation doesn’t install these extra libraries.

How do you read the package.json file, extract keys to get module names, and run npm install <keys>? The package.json would look pretty much like this:

{
  "name": "the-module",
  "dependencies": {
    "express": "2.x"
  },
  "devDependencies": {
    "ejs": ">= 0.6.1"
  },
  "testDependencies": {
    "mocha": ">= 0.8.1",
    "chai": ">= 0.3.3",
    "sinon": ">= 1.3.1"
  }
}

The command to run would be this:

npm install mocha chai sinon

Trying to do something like this:

npm install $(read-json ./package.json | extract-keys)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:05:12+00:00Added an answer on June 11, 2026 at 4:05 pm

    Check JSON.sh

    Also, you can make your one-liner shorter by using require('./package.json') directly – it’s the same as JSON.parse(require('fs').readFileSync('./package.json', 'utf-8'))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a org.w3c.dom.Node object. I would like to see if it has any
I have a simple TreePanel. I would like to select a particular node upon
I have a Drupal 6 web site and would like to use a node
I have a sample node.js project with 2 files where i would like to
I would like to have two different displays of a node teaser depending on
I would like to use CasperJS in node.js. I have referred to the following
So in my project i would like have a nice treeview that has images.
I would like to have an AppWidget that designed like this one . Image:
I would like to have a more colorful Python prompt in the terminal, just
I would like to have the cursor in the JavaDoc area when creating interfaces,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.