yo
yo copied to clipboard
Unable to run yo on macOS Ventura Beta
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
I think this was the same problem with a previous macOS release https://github.com/yeoman/yo/issues/683
Temporary Solution
Add [22, ['Ventura', '13']],
to the nameMap
.
So good
@JakeHendy Thanks for diggin’ into this issue. I’ll try to take care of this upstream issue in the next couple of days.
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.
I want to migrate the generator and environment to esm in the coming months. Maybe typescript.
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
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 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.
@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.
-
nvm install --lts
-
nvm use --lts
-
npm install -g yo
-
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]
-
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) - open
index.js
in your preferred text editor and paste[22, ['Ventura', '13']],
into line 5. - 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.
Released a fix with v4.3.1 :octocat:
@mischah thanks a lot!
Released a fix with v4.3.1 :octocat:
this errro happen in latest MacOS,( Sonoma 14.1.1 )