Can not generate Web Part Project with yo

Sivilla, John 5 Reputation points
2025-03-14T15:23:36.4366667+00:00

I am following this article https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment?source=docs

But when I run yo @microsoft/sharepoint

This is what I get:

 _-----_

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

|--(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

I tried different version of node npm and yo including 4.3.1 which was recommended.

I also have already set up plenty of other web parts with no problem. I cannot explain this happening now!

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} vote

4 answers

Sort by: Most helpful
  1. AllenXu-MSFT 24,941 Reputation points Moderator
    2025-03-17T02:14:02.7733333+00:00

    Hi @Sivilla, John,

    What's your version of Node.js? Please check by the command node --version. Here is a list of yo releases with environments they support and requires NodeJS runtimes.

    User's image


    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.

    0 comments No comments

  2. Sivilla, John 5 Reputation points
    2025-03-17T14:23:52.12+00:00

    I am using the latest versions: npm ls -g --depth=0

    C:\nvm4w\nodejs -> .\

    ├── @microsoft/generator-sharepoint@1.20.0

    ├── corepack@0.30.0

    ├── gulp-cli@3.0.0

    ├── npm@11.1.0

    ├── yeoman-environment@4.4.3

    ├── yeoman-generator@7.5.0

    └── yo@5.1.

    node -v

    v20.18.3

    P.S. I have tried different versions with no avail.

    I still get the same error!

    0 comments No comments

  3. Sivilla, John 5 Reputation points
    2025-03-17T14:54:01.3866667+00:00

    I am using the latest versions: npm ls -g --depth=0

    C:\nvm4w\nodejs -> .\

    ├── @microsoft/generator-sharepoint@1.20.0

    ├── corepack@0.30.0

    ├── gulp-cli@3.0.0

    ├── npm@11.1.0

    ├── yeoman-environment@4.4.3

    ├── yeoman-generator@7.5.0

    └── yo@5.1.

    node -v

    v20.18.3

    P.S. I have tried different versions with no avail.

    I still get the same error!

    0 comments No comments

  4. Sivilla, John 5 Reputation points
    2025-03-18T13:06:08.45+00:00

    So there is no answer for this?

    0 comments No comments

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.