New install of Node, Yo,@microsoft/sharepoint - error running sharepoint generator "generator.run is not a function"

Shawn Persels 0 Reputation points
2024-10-25T01:38:41.8+00:00

New to sharepoint development and following instructions here --> https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part

Installed fresh:

Node v20.18.0

npm 10.8.2

Yo 5.0.0

running "yo @microsoft/sharepoint" as instructed and get:

C:\Users\Shawn\spdev\test1>yo @microsoft/sharepoint

 _-----_

|       |    .--------------------------.

|--(o)--|    |      Welcome to the      |

`---------´ | SharePoint Client-side |

( _´U`_ )    |    Solution Generator    |

/___A___\    '--------------------------'

 |  ~  |

'._.'__

´ |° ´ Y

Error: generator.run is not a function

Error @microsoft/sharepoint

generator.run is not a function

Any ideas?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-10-25T07:12:59.91+00:00

    Hi @Shawn Persels,

    Per my research, you could fix the issue by downgrade to version 4.3.1. You could use the following command

    npm install -g yo@4.3.1 generator-generator
    

    And here is a similar issue with yours, please make a reference

    https://github.com/yeoman/generator-generator/issues/258


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    6 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.