2

I'm using protractor for e2e testing and grunt-task-runner package to run tests.

In my package.json file I have:

{
  ...,
  "grunt-protractor-runner": "^2.1.2",
  ...,
  "protractor": "^2.5.1",
  ...
}

And in my protractorConfig.js I use framework: 'jasmine2'

My intent is to use protractor 2.5.1 + grunt-protractor-runner 2.1.2 for node version 0.12.9, and to use protractor 3.0.0 + grunt-protractor-runner 3.0.0 for node version >=4.x.

The fact is, that when I run npm install either using node version 0.12.9 or 5.4.1, I always have the same protractor version in node_modules folder - 2.5.1 and corresponding grunt-protractor-runner.

What am I doing wrong? Any ideas would be highly appreciated.

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
aprok
  • 1,147
  • 11
  • 25

1 Answers1

1

You could try using the engines field:

{ "engines" : { "node" : ">=0.12.9 < 4" } }

But I don't think you can specify different versions of packages to install depending on the Node version.

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
  • You are right. I don't know why, but I thought that ^ or ~ give an opportunity to use compatible with nodejs versions of packages, but now I understand that it uses compatible with specified by ME version, like in here https://stackoverflow.com/questions/22343224/difference-between-tilde-and-caret-in-package-json – aprok Jan 27 '16 at 21:47