I have a basic Express app with a package.json that looks like this
{
"name": "blog",
"version": "0.0.1",
"dependencies": {
"express": "~3.0.0"
},
"engines": {
"node": "0.9"
}
}
Obviously node
itself doesn't care about contents of this file. Is there a way to start an app so that npm
would read it and report an error?
since the package.json is only a json file you can easily load and parse it, then compare the engines.node value with process.version
and report an error.
no need to do something with npm here.