Comment 1 for bug 1838474

Revision history for this message
mase (i-lp-f) wrote :

According to the documentation on https://docs.npmjs.com/files/package.json

"If you plan to publish your package, the most important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don’t plan to publish your package, the name and version fields are optional."

Looking at the NPM source code :
https://github.com/npm/cli/blob/latest/lib/npm.js

It appears NPM treats this as an exception:

  try {
    // startup, ok to do this synchronously
    var j = parseJSON(fs.readFileSync(
      path.join(__dirname, '../package.json')) + '')
    npm.name = j.name
    npm.version = j.version
  } catch (ex) {
    try {
      log.info('error reading version', ex)
    } catch (er) {}
    npm.version = ex
  }