Skip to content
This repository has been archived by the owner on Jun 3, 2019. It is now read-only.

Add a pre-install script that ensures the user is using node >= 6 #207

Closed
ctrlplusb opened this issue Nov 30, 2016 · 9 comments
Closed

Add a pre-install script that ensures the user is using node >= 6 #207

ctrlplusb opened this issue Nov 30, 2016 · 9 comments
Milestone

Comments

@ctrlplusb
Copy link
Owner

No description provided.

@ctrlplusb ctrlplusb added this to the 10.0.0 milestone Nov 30, 2016
@codepunkt
Copy link
Collaborator

What about the engines property in package.json?

@ctrlplusb
Copy link
Owner Author

Does it throw errors/warnings?

@codepunkt
Copy link
Collaborator

@ctrlplusb It throws a warning unless engineStrict is set to true, in which case it throws an error. engineStrict is deprecated though, so the user is supposed to configure his npm to either warn (default) or error on non-matched engines.

Problem with all of that is, that it doesn't run on npm run or npm install inside of the package, but when you install the node module itself - so i guess it's a no-go in this repo 😞

@ctrlplusb
Copy link
Owner Author

Thanks for the info @code-punkt!

Ok, yeah, lets still with a post-install script then. :)

@kikoanis
Copy link

kikoanis commented Dec 1, 2016

Not sure if it is really a good idea to do a post-install as all package would be already installed and built. Wouldn't be a good idea to do a pre-install. Something like this should do the trick

const exec = require('child_process').exec;
exec('npm -v', (err, stdout, stderr) => {
  if (err) throw err;
  if (parseFloat(stdout) < 3) {
    throw new Error('[ERROR: react-universally] You need npm version @>=3');
  }
});

exec('node -v', (err, stdout, stderr) => {
  if (err) throw err;
  if (parseFloat(stdout) < 6) {
    throw new Error('[ERROR: react-universally] You need node version @>=6');
  }
});

@ctrlplusb
Copy link
Owner Author

Good shout.

Thanks @kikoanis

@ctrlplusb ctrlplusb changed the title Add a post-install script that ensures the user is using node >= 6 Add a pre-install script that ensures the user is using node >= 6 Dec 6, 2016
@ctrlplusb
Copy link
Owner Author

On next

@ctrlplusb ctrlplusb reopened this Dec 6, 2016
@ctrlplusb
Copy link
Owner Author

Actually... no still open :)

@ctrlplusb
Copy link
Owner Author

And fixed... again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants