0

I developed a package for example: testlab, and its package.json is:

{
    "devDependencies": {
    "mocha": "^2.0.0"
  },
  "name": "@aab/testlab",
  "version": "2.6.0",
  "description": "example for npm",
  "main": ".\\dest\\main.js",
  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-changed": "^1.3.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "test"
  ],
  "author": "aab <aab@exmaple.com>",
  "license": "ISC"
}

Say I included mocha in devDendencies, and then I created a local directory called e.g. c:\example and used

npm install @aab/testlab --only=dev

to get my package under c:\example, but when I looked at c:\example\node_modules, I did not find mocha package is installed. I also tried other command like

npm install @aab/testlab

still no luck. I used NodeJS v4.6.0 and npm 4.0.2. Although nodeJS seems a little old, could any one help me that?

IcyBrk
  • 1,090
  • 12
  • 21
  • Duplicated with http://stackoverflow.com/questions/34700610/npm-install-wont-install-devdependencies – Tien Do Dec 01 '16 at 02:04
  • Certainly when you do "npm install mocha --save-dev", it could work, but do not know why "npm install @aab/testlab" not working – IcyBrk Dec 01 '16 at 20:43

1 Answers1

0

I have seen this happen only when NODE_ENV is set to PRODUCTION. Something else might be setting it.

Amir Raminfar
  • 33,777
  • 7
  • 93
  • 123
  • Thank you for answering, I looked at my environment variables, there is no NODE_ENV variable. – IcyBrk Dec 01 '16 at 01:55