The Yeoman Generator encounters a failure with the error message "Trying to copy from a source that does not exist."

Utkarsh Dubey 0 Reputation points
2023-11-21T13:39:10.46+00:00

I am trying to generate SharePoint Framework (SPFx) client-side web parts using the Yeoman SharePoint Generator, but it consistently presents the same error as detailed below.

C:\Users\utkarsh>yo @microsoft/sharepoint

     _-----_     ╭──────────────────────────╮
    |       |    │ Welcome to the Microsoft │
    |--(o)--|    │      365 SPFx Yeoman     │
   `---------´   │     Generator@1.18.1     │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

See https://aka.ms/spfx-yeoman-info for more information on how to use this generator.
Let's create a new Microsoft 365 solution.
? What is your solution name? testsln
? Which type of client-side component to create? WebPart
Add new Web part to solution testsln.
? What is your Web part name? testflow
? Which template would you like to use? No framework
Overwriting an existing "package.json"

Error @microsoft/sharepoint

Trying to copy from a source that does not exist: C:\Users\utkarsh\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\lib\generators\solution\templates\base\.vscode\settings.json

Developer environment

Windows 10 Pro 64 bit

Environment details

  • Node JS - v18.18.2
  • NPM - 9.8.1
  • @microsoft/generator-sharepoint - 1.18.1
  • gulp-cli - 2.3.0
  • yo - 4.3.1
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,476 Reputation points Microsoft External Staff
    2023-11-22T02:52:09.53+00:00

    Hi @Utkarsh Dubey,

    Per my research, you should take following steps to fix the issue

    1. remove node js (using control panel)
    2. reinstall node js, you will need to install the correct version by refering following list

    https://learn.microsoft.com/en-us/sharepoint/dev/spfx/compatibility

    1. Then try to run following script:
    npm i -g gulp-cli yo
    npm i -g @microsoft/generator-sharepoint
    

    Here is a similar issue with yours

    https://stackoverflow.com/questions/67613318/error-code-trying-to-copy-from-a-source-that-does-not-exist


    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.

    1 person found this answer helpful.

  2. Utkarsh Dubey 0 Reputation points
    2024-02-27T13:10:05.0333333+00:00

    I resolved the issue through the following steps:

    • Installed Node.js and NPM on the D Drive.
      • The organization has created permission access to restrict file access from the C drive.
    • Deleted the NPM cache folder located within the AppData directory.
    • Restart the system.
    • There are some issues in latest YO (Yeoman) NPM package (version 5) therefore I've reverted it to an older version of the YO (Yeoman) package.
    • Utilized NVM to manage multiple Node.js versions as per my requirements.

    Hope this steps help someone to fix issue they are encountering when working on SharePoint Framework (SPFx).

    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.