Detect potential issues with users system that could prevent Yeoman from working correctly
Use as part of yo
:
$ yo doctor
Can also be run with yo-doctor
if installed globally.
BSD-2-Clause © Google
Detect potential issues with users system that could prevent Yeoman from working correctly
Home Page: http://yeoman.io
License: BSD 2-Clause "Simplified" License
Detect potential issues with users system that could prevent Yeoman from working correctly
Use as part of yo
:
$ yo doctor
Can also be run with yo-doctor
if installed globally.
BSD-2-Clause © Google
I want to install yeoman in my monorepo project... and wrap it as part of another tool (that registers the package elsewhere in the monorepo). however, this seems to annoy the doctor:
Yeoman Doctor
Running sanity checks on your system
✔ No .bowerrc file in home directory
✔ Global configuration file is valid
✖ NODE_PATH matches the npm root
Unable to find the npm root, something went wrong.
Try to execute npm -g root --silent on your command-line
✔ No .yo-rc.json file in home directory
✔ Node.js version
✔ npm version
✔ yo version
Found potential issues on your machine :(
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
added 684 packages from 392 contributors and audited 4310 packages in 18.171s
19 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Is this verify
necessary / useful? Can it be updated to support non-global installs?
Lines 43 to 62 in df93f8a
Currently the bin
command is yodoctor
, maybe yo-doctor
is more readable?
I am unable to run yo, so I ran "yo doctor" and I am getting the error message below.
Yeoman Doctor
Running sanity checks on your system
√ No .bowerrc file in home directory
√ Global configuration file is valid
× NODE_PATH matches the npm root
Unable to find the npm root, something went wrong.
Try to execute npm -g root --silent on your command-line
√ No .yo-rc.json file in home directory
√ Node.js version
√ npm version
√ yo version
Found potential issues on your machine :(
NOTES:
Bug reported on twitter https://twitter.com/reklatsmasters/status/935225748931084289/
Looks like the chalk style or the templates are messed up...
it has been a while since i've built a new generator, so i overlooked the requirement to name the sub-generator that is intended to be the default, even if it is the only sub-generator, as app
. i burned several evenings trying to sort out why the generator was not showing up in the list shown by the yo
command.
finally i opened yeoman/yeoman#1640 and was given a few tips that led me to realize the mistake. before opening the issue above, i had run yo doctor
several times, so if it had warned me that it was finding my generator but not showing it in the list because of a lack of defining a default, i would have realized and fixed my issue far more quickly.
if it matters, i expect that this would mostly be helpful only for npm link
ed generators since those are most likely work-in-progress.
Maintaining array/strings is pretty hard (and even harder to format correctly).
We should move to a template system and maintain the errors output inside text files.
(also, @sindresorhus was thinking about simplifying chalk coloring in templates - ETA on that?)
If you look at this commit c9c6a23 it means yeoman need npm3. But nodejs LTS is 4.X and this means npm is 2.X not 3.X
Should we revert partially this change and ask for node 4 and npm 2 ?
I want to align our output correctly so it is easier to read:
[Yeoman Doctor] Running sanity checks on your system
NODE_PATH match the npm root....................................OK
Global configuration file is valid..............................OK
Everything looks all right!
Two goals:
There's a lot of table modules that could work, but they return a blob string rather than line per line. We need line per line here because in case of errors, we'll output help information under each check line.
A solution could be to just split the table module output on new lines and match the index, but I want to run it to the team before. There's probably a solution out there already.
This can cause problems if a generator counts on bower_components
being in a specific place. In generator(-gulp)-webapp we fixed this by adding a local .bowerrc
.
I've seen this issue a few times. Basically the user have a yo
version installed, and their npm now install in a different binary folder. This cause an issue where the user always use the old yo version as their new ones is not found on their path.
I'm unsure how we could detect this, but the issue is clear when you check where npm installs modules against what is returned with which yo
(where yo
on windows)
See yeoman/yo#787
Most relevant for the following package versions:
bin-version-check: < v5.0.0
latest-version: < v6.0.0
Following up on the three PRs from last month, could we get a new version so these changes can go live?
I tried installing yo using
npm install -g yo
but it gave the error for not having the correct version of npm installed
I already have the latest npm installed which is 2.11.1 as shown below:-
Kindly fix it, as i cannot installed generator like generator-ko
Your environment has been set up for using Node.js 0.12.4 (ia32) and npm.
C:\Users\kowsh>npm -version
2.11.1
C:\Users\kowsh>yo doctor
Yeoman Doctor
Running sanity checks on your system
V Global configuration file is valid
V NODE_PATH matches the npm root
V Node.js version
× npm version
Your npm version is outdated.
Upgrade to the latest version by running:
npm install -g npm
See this guide if you're having trouble upgrading:
https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
V No .bowerrc file in home directory
V No .yo-rc.json file in home directory
Found potential issues on your machine :(
If you install yo
on Node 0.10.x
(which meets the requirements in yo
's package.json
), you get the following warning from yodoctor
:
✖ Node.js version
Your Node.js version is outdated.
Upgrade to the latest version: https://nodejs.org
...
Found potential issues on your machine :(
Either this "warning" seems a little more severe than it is (I believe this to be the case), or if this is really gonna cause issues (running on 0.10.x
), yo
needs to be more clear on what version(s) of Node it can run on.
If perhaps, it still runs fine on 0.10.x
, but you're just suggesting to update, the message could better reflect that:
⚠ Node.js version
Your Node.js version is outdated. Yeoman will work on this version of Node.js, but [insert reasons (speed, security, 3rd party module support), etc here].
Upgrade to the latest version: https://nodejs.org
...
(omit "Found potential issues" message if this is the only issue)
When I try to install yeoman npm install -g yo
, I receive the following status at the end of the install from yo doctor:
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
√ No .yo-rc.json file in home directory
× yo version
Your yo version is outdated.
Upgrade to the latest version by running:
npm install -g yo@latest
√ npm version
Found potential issues on your machine :(
So I tried npm install -g yo@latest
but I end up with the same issue. It is to be noted that it was the first time I installed yo on this machine. I could not find any ressource regarding this issue, but please let me know if there is a simple solution.
Thanks,
Because unit test are super important!
Right now it is very shameful (and I admit it's my fault)
Just realized yo doctor script doesn't resolve paths and match them based on their "string" value.
It should path.resolve()
paths before comparison.
When yeoman-doctor is installed globally (npm install -g yeoman-doctor), it doesn't use any proxy environment variables. That issue is related to yeoman/yo#589.
Example of error:
○ → yodoctor
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
✔ No .yo-rc.json file in home directory
✔ npm version
{ RequestError: connect ECONNREFUSED 104.16.27.35:443
at ClientRequest.req.once.err (/home/simon/.nvm/versions/node/v8.12.0/lib/node_modules/yeoman-doctor/node_modules/got/index.js:73:21)
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)
Today I installed yeoman and yeoman doctor flagged an issue with "NODE_PATH matches the npm root".
In this Google did not appear to be my friend so I started investigating myself.
I found yeoman-doctor/lib/rules/node-path.js and started debugging the old way by adding console.log
lines. In the exported function verify
I added a console.log
for the error in the catch. The error message read "TypeError: filepath.trim is not a function".
In the complete script file there is only one line with a trim function and that is in the function fixPath. That function is being called on 2 places, for each of the paths in the NODE_PATH environment value and once for the output of the command npm -g root --silent
so I added a console.log line to the fixPath
function to see the incoming value of filepath. The output of npm -g root --silent
appeared to contain a new line character all the rest looked normal so I suspected that new line to be the culprit. So I tried to replace it with filepath.replace(/^\n|\n$/g, '')
but it only made the error being thrown by the replace function instead. At this point I wondered how this could be, a quick Google and the wisdom of "don't trust your input" got me the idea of adding toString()
to the filepath
variable before the trim function. That did the trick, the error went away and "NODE_PATH matches the npm root" was being flagged as okay.
I could create a pull request for my fix but first I want to make sure if I'm not missing anything obvious.
It would be great to also check the current version of yeoman-environment
and update it if needed.
Here is the output of the same:
$ yo doctor
/usr/local/lib/node_modules/yo/lib/cli.js:43
require('yeoman-doctor').run();
^
TypeError: Object function () {
var errCount = 0;
console.log('\n' + chalk.underline.blue('Yeoman Doctor'));
console.log('Running sanity checks on your system\n');
eachAsync(objectValues(rules), function (rule, i, cb) {
rule.verify(function (err) {
console.log(err ? symbols.error : symbols.success + ' ' + rule.description);
if (err) {
errCount++;
console.log(err);
}
cb();
});
}, function () {
if (errCount === 0) {
console.log(chalk.green('\nEverything looks all right!'));
} else {
console.log(chalk.red('\nFound potential issues on your machine :('));
}
});
} has no method 'run'
at pre (/usr/local/lib/node_modules/yo/lib/cli.js:43:30)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:156:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
Lots of bug reports on the tracker about files being generated in the home directory.
We should warn users if there's a .yo-rc.json file there - it is probably an error!
npm version check on windows shall use 'npm.cmd' as argument and not only 'npm' when calling binVersionCheck function
Hey,
I crashed to an issue where have to find out that yeoman did not scaffold in my current dir.
I put my in $HOME/code. In this directory I started a scaffold by mistake, so an .yo-rc.json was created.
yo doctor did not show me this in any kind, then I was in a dir like $HOME/code/myApplication. It was a stupid mistake on my side, but it could be useful if yeoman can tell me, that I have a yo-file in one of my parent directories to remove any surprise.
https://github.com/felixrieseberg/npm-windows-upgrade
PR welcome :)
I know that this issue is very similar to issue #19 and it seems like the internet has lots of solutions to this problem, but I have tried several and they don't seem to be working for me. I think I may have isntalled multiple versions of NPM, how can I confirm that? If that is indeed the problem, how can I purge and reinstall properly? Here's what is going on:
` sudo npm install -g yo generator-kraken bower grunt-cli
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
/home/sean/.npm/bin/grunt -> /home/sean/.npm/lib/node_modules/grunt-cli/bin/grunt
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
/home/sean/.npm/bin/yo -> /home/sean/.npm/lib/node_modules/yo/lib/cli.js
[email protected] postinstall /home/sean/.npm/lib/node_modules/yo
yodoctor
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
✔ No .yo-rc.json file in home directory
✖ npm version
Your npm version is outdated.
Upgrade to the latest version by running:
npm install -g npm
Found potential issues on your machine :(
[email protected] postinstall /home/sean/.npm/lib/node_modules/generator-kraken/node_modules/yeoman-generator/node_modules/cross-spawn/node_modules/spawn-sync
node postinstall
/home/sean/.npm/bin/bower -> /home/sean/.npm/lib/node_modules/bower/bin/bower
[email protected] /home/sean/.npm/lib/node_modules/grunt-cli
├── [email protected] ([email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected])
[email protected] /home/sean/.npm/lib/node_modules/yo
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] /home/sean/.npm/lib/node_modules/generator-kraken
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] /home/sean/.npm/lib/node_modules/bower
`
Thank you very much for your help, I know that this issue probably has a simple solution, I am just having a hard time understanding what it is.
Only supporting sync flow is pretty limiting (and not super future friendly). We should move to make every rule with a callback (even if they're not actually sync).
I get the following whilst running npm i -g yo
[user@ip ~]$ npm i -g yo
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
/usr/bin/yo -> /usr/lib/node_modules/yo/lib/cli.js
/usr/bin/yo-complete -> /usr/lib/node_modules/yo/lib/completion/index.js
> [email protected] postinstall /usr/lib/node_modules/yo/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] postinstall /usr/lib/node_modules/yo/node_modules/ejs
> node ./postinstall.js
> [email protected] postinstall /usr/lib/node_modules/yo/node_modules/spawn-sync
> node postinstall
> [email protected] postinstall /usr/lib/node_modules/yo
> yodoctor
/usr/lib/node_modules/yo/node_modules/yeoman-doctor/lib/index.js:12
(async () => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/yo/node_modules/yeoman-doctor/lib/cli.js:3:1)
/usr/lib
└── (empty)
npm ERR! Linux 3.10.0-1127.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "-g" "yo"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'yodoctor'.
Doesn't look to be anything I can fix on the local machine, happy to be proven otherwise!
In project scan we are getting vulnerability issue for semver version "Versions of the package semver before 7.5.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range, when untrusted user data is provided as a range."
Please update the semver version > 7.5.2.
Please update the package dependencies.
Installing software using the latest version of yeoman-doctor gives deprecation warnings:
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
The package was updated in an upstream dependency, execa
, which eventually was updated in bin-version-check version 4.0.0:
Not sure if you noticed this or not, but you added a dependency recently that is GPL:
https://github.com/yeoman/doctor/blob/master/package.json#L29
https://github.com/tizzo/chalk-twig-filters/blob/master/package.json#L19
This makes this rather hard for some of us corporate users to upgrade to this latest version.
I've filed an issue with the module owner asking to dual license it:
tizzo/chalk-twig-filters#1
Just wanted you to be aware of this modules license 😄
Related to yeoman/yo#616
Output here: https://gist.github.com/eddiemonge/8c4c904720f9b716b8a1
Yo doctor should fail if npm
can't run.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.