yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.84k stars 398 forks source link

Error: pkg.name and pkg.version required #729

Closed nandaccio closed 2 years ago

nandaccio commented 2 years ago

Type of issue

BUG


My environment

Current behavior

image

Steps to reproduce the behavior

Running yo from a command prompt (yo + return)

Command line output

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)

Node.js v17.3.0

List of generators:

yo --generators
Available Generators:

  angular-fullstack
    component
    controller
    decorator
    directive
    endpoint
    factory
    filter
    heroku
    openshift
    provider
    route
    service
  aspnet
    nugetconfig
    webconfig
  code

  gulp-webapp

  karma

  ng-fullstack
    component
    controller
    decorator
    directive
    endpoint
    factory
    filter
    model
    module
    pipe
    resource
    service
    style
    view
  office

  teams
    bot
    connector
    custombot
    localization
    messageExtension
    tab
  webapp
nandaccio commented 2 years ago

I deleted all the generators above and then "yo" ran without issues, but after re-installing one of them, I got the same error:

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 ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\yo\lib\routes\install.js:150:11)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at ChildProcess.cp.emit (C:\Program Files\nodejs\node_modules\yo\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1062:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
nandaccio commented 2 years ago

Issue seems caused by https://github.com/microsoft/vscode-generator-code , removing this generator solves the problem.