Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: pkg.name and pkg.version required (Node.js: v17.3.0) #325

Closed
nandaccio opened this issue Dec 21, 2021 · 3 comments
Closed

Error: pkg.name and pkg.version required (Node.js: v17.3.0) #325

nandaccio opened this issue Dec 21, 2021 · 3 comments
Assignees
Milestone

Comments

@nandaccio
Copy link

Yo stops working after installing generator-code:

image

C:\Program Files\nodejs\node_modules\yo\node_modules\update-notifier\index.js:32
                        throw new Error('pkg.name and pkg.version required');
                        ^

Error: pkg.name and pkg.version required
    at new UpdateNotifier (C:\Program Files\nodejs\node_modules\yo\node_modules\update-notifier\index.js:32:10)
    at module.exports (C:\Program Files\nodejs\node_modules\yo\node_modules\update-notifier\index.js:150:25)
    at resolveGenerators (C:\Program Files\nodejs\node_modules\yo\lib\router.js:74:20)
    at Router.updateAvailableGenerators (C:\Program Files\nodejs\node_modules\yo\lib\router.js:84:7)
    at runYo (C:\Program Files\nodejs\node_modules\yo\lib\cli.js:188:10)
    at init (C:\Program Files\nodejs\node_modules\yo\lib\cli.js:149:5)
    at pre (C:\Program Files\nodejs\node_modules\yo\lib\cli.js:89:3)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\yo\lib\cli.js:219:3)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)

Note: deleting or even renaming the "generator-code" folder to something else (e.g. dummy_generator-code) solves the issue.
Re-installing generator-code or removing dummy_ makes the issue re-surface. Other generators are not affected.

Node.js: version 17.3.0
npm: 8.3.0
yo: 4.3.0
generator-code: 1.6.5

@eamodio
Copy link
Contributor

eamodio commented Jan 5, 2022

I am having the same issue.

Node: 14.18.1
npm: 8.3.0 (though happened before I tried upgrading npm too)
yo: 4.3.0 (though happened on 3.1.1 before upgrading too)
generator-code: 1.6.5

/cc @aeschli

@eamodio
Copy link
Contributor

eamodio commented Jan 5, 2022

I'm not sure how to really fix this, but the issue is that there is a package.json file inside the generators/app folder, and yo is using that rather than the root package.json. And that nested package.json is missing required fields.

@eamodio
Copy link
Contributor

eamodio commented Jan 5, 2022

I was able to fix it by adding the following to the generators/app/package.json

      "name": "generator-code",
      "version": "1.6.5",
      "description": "Yeoman generator for Visual Studio Code Extensions",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants