yo icon indicating copy to clipboard operation
yo copied to clipboard

Unable to install yo through npm because "Your yo version is outdated"

Open lamoreauxaj opened this issue 7 years ago • 43 comments

Type of issue

Bug


My environment

  • OS version/details: Ubuntu 18.04
  • Node version: 10.5.0 (run node --version in your terminal)
  • npm version: 6.1.0 (run npm --version in your terminal)
  • Version of yo : 2.0.4 (run yo --version in your terminal)

Expected behavior

Running npm install yo -g always fails on yo doctor. I would expect it to successfully install.

Current behavior

Installing yo always fails with "Your yo version is outdated". This prevents the install from succeeding and therefore I am unable to use the package globally.

Steps to reproduce the behavior

Run npm install yo -g and it fails on my system.

Command line output

lamoreauxaj@lamoreauxaj:~$ npm install yo -g
/opt/node-v8/lib/node_modules/node/bin/yo -> /opt/node-v8/lib/node_modules/node/lib/node_modules/yo/lib/cli.js
/opt/node-v8/lib/node_modules/node/bin/yo-complete -> /opt/node-v8/lib/node_modules/node/lib/node_modules/yo/lib/completion/index.js

> [email protected] postinstall /opt/node-v8/lib/node_modules/node/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
✖ 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 :(
+ [email protected]
updated 1 package in 10.616s

lamoreauxaj avatar Jul 11 '18 02:07 lamoreauxaj

Did you try:

npm install -g yo@latest

or

npm rm -g yo
npm install -g yo

mischah avatar Jul 11 '18 06:07 mischah

These both continue to fail. I can install it locally though. npm install yo doesn't fail.

lamoreauxaj avatar Jul 11 '18 12:07 lamoreauxaj

I ran into this issue too with 8.11.3 version of Node.js on Windows. I downgraded to 8.0.0 version and it fixed the issue.

tinaschrepfer avatar Jul 12 '18 21:07 tinaschrepfer

+1 to tinaschrepfer. I'm hitting this issue on Windows Server 2016 & Node.js 8.11.3.

Tried both "npm install -g yo@latest" and "npm rm -g yo", "npm install -g yo" but it didn't help.

D:\temp\vsext>npm install -g yo
C:\Users\sakono\AppData\Roaming\npm\yo -> C:\Users\sakono\AppData\Roaming\npm\node_modules\yo\lib\cli.js
C:\Users\sakono\AppData\Roaming\npm\yo-complete -> C:\Users\sakono\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js
npm WARN lifecycle The node binary used for scripts is C:\GITCF\node.exe but npm is using C:\Program Files\nodejs\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] postinstall C:\Users\sakono\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall C:\Users\sakono\AppData\Roaming\npm\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
× 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 :(
+ [email protected]
added 625 packages from 267 contributors in 33.362s

D:\temp\vsext>

sakono2 avatar Jul 23 '18 04:07 sakono2

Very old version of Node was unexpectedly in my path. Removing it fixed the issue.

sakono2 avatar Jul 23 '18 05:07 sakono2

Running into the same issue: image

Please fix or at least update instructions because npm install -g yo@latest doesn't resolve the issue. Uninstalling and re-installing the package didn't address the issue either.

ydogandjiev avatar Jul 30 '18 18:07 ydogandjiev

Are the following paths relatively the same? (bash commands, translate them to other shells if needed)

npm list -g | head -n 1
which yo

For example, I get:

/Users/username/.nvm/versions/node/v10.5.0/lib
/Users/username/.nvm/versions/node/v10.5.0/bin/yo

And the version check runs OK.

MarcoScabbiolo avatar Jul 31 '18 01:07 MarcoScabbiolo

The issue I encountered was caused by a bad prefix value in my .npmrc file which was pointing to a non-existent version of Node. I still have no idea what tool set that but it completely busted my ability to globally install npm packages. Removing the prefix from my .npmrc file resolves the issue. This might be something the Yeomen Doctor could be taught to detect.

ydogandjiev avatar Jul 31 '18 16:07 ydogandjiev

@ydogandjiev can you give us more details? What was the prefix path - what was at this path? Was it empty/non-existing?

SBoudrias avatar Aug 01 '18 03:08 SBoudrias

@ydogandjiev Your solution worked for me.

jermsull avatar Aug 02 '18 19:08 jermsull

could you give me detail about the solution, I have the same problem, and I'm new in linux Thank you so much

bvh165 avatar Aug 04 '18 02:08 bvh165

I have this same problem but there's nothing in my local .npmrc except proxy info.

aaronhawryluk avatar Aug 06 '18 19:08 aaronhawryluk

λ npm install -g yo@latest C:\Users<XXXXXXX>\AppData\Roaming\npm\yo -> C:\Users<XXXXXXX>\AppData\Roaming\npm\node_modules\yo\lib\cli.js C:\Users<XXXXXXX>\AppData\Roaming\npm\yo-complete -> C:\Users<XXXXXXX>\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js

[email protected] postinstall C:\Users<XXXXXXX>\AppData\Roaming\npm\node_modules\yo yodoctor

Yeoman Doctor Running sanity checks on your system

√ Global configuration file is valid √ Node.js version √ No .bowerrc file in home directory √ No .yo-rc.json file in home directory √ npm version √ NODE_PATH matches the npm root × yo version

Your yo version is outdated.

Upgrade to the latest version by running: npm install -g yo@latest

Found potential issues on your machine :(

aaronhawryluk avatar Aug 06 '18 19:08 aaronhawryluk

@aaronhawryluk please refer to #589 if you think your proxy is causing this issue

MarcoScabbiolo avatar Aug 07 '18 01:08 MarcoScabbiolo

@ydogandjiev thanks for the solution.

Regarding the details --> open .npmrc file (Hidden file inside HOME in mac or C: in Windows) and delete the 'PREFIX' parameter written in it.

nnawin avatar Aug 07 '18 10:08 nnawin

In my case I need the prefix on my mac os sytem or i can't install any package globaly .. https://johnpapa.net/node-and-npm-without-sudo/ So in both case (with or witheout prefix) i can't install it any suggestions ?

Edit : My bad yo is installed but I just can't pass the "sanity checks"

msitruk avatar Aug 07 '18 14:08 msitruk

@msitruk you could try using nvm - it handles prefix automatically and does pass the yo check on my side.

Also, if anyone want to dig into why this issue started happening recently. You might want to review https://github.com/yeoman/doctor/blob/8692a7189a81983e085f75d4bc62d9bccc2615fa/lib/rules/yo-version.js (the high level code is pretty simple)

It could be a few things:

  1. Maybe there's bug in old version of the latest-version library. We can try bumping to latest.
  2. Any chance you're having 2 version of yo installed on your computer? One coming from an old version of node/npm for example?

And also, keep in mind yo still gets installed. These are warnings.

SBoudrias avatar Aug 08 '18 03:08 SBoudrias

Found my issue. This is proxy-related but not an actual proxy issue. I have to put my user name and password for the proxy into my HTTP_PROXY system variable (it's an authenticating proxy), and it turns out that now that value needs to be encoded since it has special characters. So just changed any special characters in the proxy environment variable to %XX, and now it works perfectly. This wasn't necessary for some reason with older versions, but things change I guess. shrug

aaronhawryluk avatar Aug 23 '18 15:08 aaronhawryluk

I am getting the same issue on Windows 7. I am not certain where to find the .npmrc file mentioned on this thread on windows. Nothing I can see on c: drive.

Any suggestions on how to fix this on Windows?

AmolM27 avatar Sep 07 '18 09:09 AmolM27

Thanks @ydogandjiev, your solution worked for me too!

NavarroMauro avatar Sep 10 '18 11:09 NavarroMauro

Hello, I seem t be having the exact same issue. Can please someone assist? Node Version: 8.11.3 + NPM Version 5.6.0 Express Version : 4.16.3 Mongodb + Shell / Versions: 4.0.2 Grunt Version: 1.0.3 Debug version: 4.00 Git version: 2.18

c:\>npm install -g yo npm WARN deprecated [email protected]: debugversions 3.2.0-3.2.2 break Node 4. Users of node LTS and onward (modern Node versions): please upgrade todebug@4or above as soon as possible. Node 4 users: please pin todebug@>=3.2.3 <4` as it will be the last version range that supports Node@4. [ .........] / extract:chalk: sill pacote trying registry-auth-token@https://registry.npmjs.org/registry-auth-token/-/regist[ .........] / extract:string-width: sill pacote trying strip-indent@https://registry.npmjs.org/strip-indent/-/strip-i C:-----------\AppData\Roaming\npm\yo-complete -> C:-----------\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js C:-----------\AppData\Roaming\npm\yo -> C:-----------\AppData\Roaming\npm\node_modules\yo\lib\cli.js

[email protected] postinstall C:-----------\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync node postinstall

[email protected] postinstall C:-----------\AppData\Roaming\npm\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 × 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 :(

c:>npm install -g yo@latest npm WARN deprecated [email protected]: debug versions 3.2.0-3.2.2 break Node 4. Users of node LTS and onward (modern Node versions): please upgrade to debug@4 or above as soon as possible. Node 4 users: please pin to debug@>=3.2.3 <4 as it will be the last version range that supports Node@4. C:-----------\AppData\Roaming\npm\yo-complete -> C:-----------\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js C:-----------\AppData\Roaming\npm\yo -> C:-----------\AppData\Roaming\npm\node_modules\yo\lib\cli.js

[email protected] postinstall C:-----------\AppData\Roaming\npm\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 × 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 :(

c:>yo --version 'yo' is not recognized as an internal or external command, operable program or batch file.

c:>yo --version 'yo' is not recognized as an internal or external command, operable program or batch file.

c:>git --version 'git' is not recognized as an internal or external command, operable program or batch file.

c:>npm i debug npm WARN saveError ENOENT: no such file or directory, open 'c:\package.json' npm WARN enoent ENOENT: no such file or directory, open 'c:\package.json' npm WARN !invalid#1 No description npm WARN !invalid#1 No repository field. npm WARN !invalid#1 No README data npm WARN !invalid#1 No license field.

c:>mpm install -g yo 'mpm' is not recognized as an internal or external command, operable program or batch file.

c:>npm install -g yo npm WARN deprecated [email protected]: debug versions 3.2.0-3.2.2 break Node 4. Users of node LTS and onward (modern Node versions): please upgrade to debug@4 or above as soon as possible. Node 4 users: please pin to debug@>=3.2.3 <4 as it will be the last version range that supports Node@4. C:\Users\247UNITEDHUB\AppData\Roaming\npm\yo -> C:\Users\247UNITEDHUB\AppData\Roaming\npm\node_modules\yo\lib\cli.js C:\Users\247UNITEDHUB\AppData\Roaming\npm\yo-complete -> C:\Users\247UNITEDHUB\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js

[email protected] postinstall C:\Users\247UNITEDHUB\AppData\Roaming\npm\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 × 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 :(

Been using the Windows CMD to do this on Windows 10 `

bridgetsarah avatar Sep 11 '18 20:09 bridgetsarah

I was having the same problem in Linux .. × yo version Found potential issues on your machine :(

I had used sudo npm install -g yo@latest and it worked fine.. try it out

captPython avatar Sep 20 '18 00:09 captPython

I followed the steps on this page - 'How to Prevent Permissions Errors' https://docs.npmjs.com/getting-started/fixing-npm-permissions and it fixed the problem for me

BenjaminTanSF avatar Oct 10 '18 03:10 BenjaminTanSF

@ydogandjiev your solution help me.

renanscosta avatar Oct 11 '18 13:10 renanscosta

I had the same issue, but I ran mine in a PowerShell window from within VS Code (I always do). After I ran VS Code as Administrator permission, I was able to run the upgrade successfully.

pmatthews05 avatar Oct 18 '18 10:10 pmatthews05

These both continue to fail. I can install it locally though. npm install yo doesn't fail.

but it does not fix the problem while using command like "yo -v". So how to fix it totally

phaldon avatar Oct 30 '18 06:10 phaldon

The issue I encountered was caused by a bad prefix value in my .npmrc file which was pointing to a non-existent version of Node. I still have no idea what tool set that but it completely busted my ability to globally install npm packages. Removing the prefix from my .npmrc file resolves the issue. This might be something the Yeomen Doctor could be taught to detect.

If you are mac user, so first of all you have to show hidden files using this command in your terminal > defaults write com.apple.Finder AppleShowAllFiles YES After you need open HOME folder ( white home with triangle roof ) and find there file .npmrc and open it. Inside you will see this text prefix$~/.npm-global and just delete prefix$~/. this part so now you have only npm-global That's work for me :) ydogandjiev thank you a lot!

ghost avatar Dec 08 '18 10:12 ghost

@Lamoreauxaj Thanks,, working at Linux Mint with npm install yo screenshot from 2018-12-11 11-15-00

xhafid avatar Dec 11 '18 04:12 xhafid

@xhafid your above solutions works for thanks

tbanj avatar Jan 05 '19 04:01 tbanj

@ydogandjiev It works!Thank you so much

file path(Windows 10):

 C:\Users\UserName\.npmrc

npmrc

cooguyan avatar Jan 05 '19 08:01 cooguyan