yo icon indicating copy to clipboard operation
yo copied to clipboard

Unable to run yo on macOS Ventura Beta

Open JakeHendy opened this issue 1 year ago • 4 comments

Type of issue

Bug.

My environment

  • OS version/details: macOS Ventura 13.0 Public Beta
  • Node version: 18.3.0
  • npm version: 8.11.0
  • Version of yo : 4.3.0

Expected behavior

When running any generator, the generator should complete successfully.

Current behavior

The generator stops because the insights package uses a version of os-name which doesn't have the latest macos-release in, and there is no try-catch surrounding the insights invocation: https://github.com/yeoman/yo/blob/1fe6ad17e80ac8a7a5a34cd9a80397f4d637fc0c/lib/cli.js#L54 This causes the cli to stop execution immediately. Running the command with --no-insight does not stop this line being invoked. Manually patching the macos-release file does of course, allow you to bypass this.

Steps to reproduce the behavior

Use macOS Ventura to run any yeoman generator.

Command line output

❯ yo --no-insight @microsoft/sharepoint                                 12:28:32
/usr/local/lib/node_modules/yo/node_modules/macos-release/index.js:27
	const [name, version] = nameMap.get(release);
	                        ^

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at macosRelease (/usr/local/lib/node_modules/yo/node_modules/macos-release/index.js:27:26)
    at osName (/usr/local/lib/node_modules/yo/node_modules/os-name/index.js:21:18)
    at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:37:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:54:17)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Node.js v18.3.0

JakeHendy avatar Jul 19 '22 11:07 JakeHendy

I think this was the same problem with a previous macOS release https://github.com/yeoman/yo/issues/683

1cedsoda avatar Jul 22 '22 15:07 1cedsoda

Temporary Solution

Add [22, ['Ventura', '13']], to the nameMap. CleanShot 2022-07-26 at 15 31 32@2x

bytemain avatar Jul 26 '22 07:07 bytemain

So good

jntombebe avatar Aug 17 '22 16:08 jntombebe

@JakeHendy Thanks for diggin’ into this issue. I’ll try to take care of this upstream issue in the next couple of days.

mischah avatar Aug 26 '22 07:08 mischah

It’s not as easy as I thought 🙈 Because we have to update sindresorhus/os-name to v5.0.1 in yeoman/insight.

BUT: os-name is a pure ESM since 5.0.0. which means we have to change the module system in insight as well as described over here: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

… which means we have to refactor yeoman/yo as well to make this work 😔

I’m starting to work on this now.

mischah avatar Oct 15 '22 20:10 mischah

I want to migrate the generator and environment to esm in the coming months. Maybe typescript.

mshima avatar Oct 20 '22 13:10 mshima

So, Ventura is out of beta now. We are all updated, and yet, Yeoman is broken. Question, why a templating tool needs the type of the system it runs on? Can't we disconnect/remove the insights tool, at least until it got fixed?

/cc @sindresorhus @mischah @mshima

sneridagh avatar Nov 03 '22 13:11 sneridagh

You are absolutely right. At the latest with the final version of Ventura, a yeoman version should have been released that fixes this problem 🙈

So I think a quick patch release is a pretty darn idea. I’m going to prepare a pull request which will remove insights for now.

I could publish this fix tomorrow. As long no core team member has strong arguments against this temporary fix.

Maybe @SBoudrias or @addyosmani know if the data fetched by yeoman/insight is used 🤔 I have never seen any statistics.


I have sadly little time (and energy 😆) for doing Open Source stuff as this is unfortunately not my day Job. So a proper fix will take a couple of more days for me (as described above):

It’s not as easy as I thought 🙈 Because we have to update sindresorhus/os-name to v5.0.1 in yeoman/insight.

BUT: os-name is a pure ESM since 5.0.0. which means we have to change the module system in insight as well as described over here: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

… which means we have to refactor yeoman/yo as well to make this work 😔

mischah avatar Nov 03 '22 16:11 mischah

@mischah thanks for answering, I know what you are talking about, I'm an OSS maintainer as well. So no worries. That's why I was wondering if a low code solution, like just plain disable the insights right now would be a sensible solution right now. Specially if nobody is using that "insights" :) Also, IMHO it's ugly to have code that "calls home" in an OSS project...

So, any quick solution would be highly appreciated. Thanks a lot for taking care.

sneridagh avatar Nov 03 '22 16:11 sneridagh

@mischah Thanks for being willing to push out a fix. Thankfully there is a very easy workaround.

In the meantime, I will list the steps I took to get it running.

I use nvm on my machine as I work across several projects requiring different node versions.

  1. nvm install --lts
  2. nvm use --lts
  3. npm install -g yo
  4. npm -g ls macos-release

You will get an output something along these lines...

/Users/yourusername/.nvm/versions/node/v18.12.0/lib
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └── [email protected]
  1. cd to the path listed, in this case for me it's ~/.nvm/versions/node/v18.12.0/lib/node_modules/yo/node_modules/macos-release/ (the path above, plus navigating to the package that is problematic)
  2. open index.js in your preferred text editor and paste [22, ['Ventura', '13']], into line 5.
  3. Save the file and run yo. It should run perfectly.

I'll cross-post this to the other issues I have seen referencing this problem.

AlexSwensen avatar Nov 03 '22 19:11 AlexSwensen

Released a fix with v4.3.1 :octocat:

mischah avatar Nov 07 '22 15:11 mischah

@mischah thanks a lot!

sneridagh avatar Nov 08 '22 09:11 sneridagh

Released a fix with v4.3.1 :octocat:

this errro happen in latest MacOS,( Sonoma 14.1.1 )

Temporary Solution:

image

wangjs-jacky avatar Dec 06 '23 03:12 wangjs-jacky