Skip to content

Crash if npm is not in the PATH #33

Description

@cbornet

Currently yodoctor does a npm --version to get npm's version but that crashes if npm is not on the PATH.
It should instead only give a warning that npm was not found.
(I guess the fix could be in bin-version-check but the project doesn't seem very lively...)

See srs/gradle-node-plugin#134 for a use case where npm isn't found.

Stack trace:

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✖ No .bowerrc file in home directory

We found a undefined file in your home directory. This can cause
issues by overriding expected default config. Prefer setting up one `.bowerrc` per
project.

To delete the file, run: rm ~/.bowerrc

✔ No .yo-rc.json file in home directory
/home/jhipster/app/node_modules/semver-truncate/index.js:12
                throw new Error('Version ' + version + ' is not valid semver');
                ^

Error: Version null is not valid semver
    at module.exports (/home/jhipster/app/node_modules/semver-truncate/index.js:12:9)
    at /home/jhipster/app/node_modules/bin-version-check/index.js:20:25
    at /home/jhipster/app/node_modules/bin-version/index.js:15:3
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions