Troubleshoot error ‘cp’ is not recognized as a command

16 Oct 20251 minute to read

The Unix cp command is not available in the Windows Command Prompt. Use one of the following Windows-native alternatives to copy the required assets.

  • CMD (xcopy) — recursive directory copy:
xcopy /s /e /i .\node_modules\@syncfusion\ej2-pdfviewer\dist\ej2-pdfviewer-lib public\ej2-pdfviewer-lib
  • PowerShell (Copy-Item) — recursive directory copy:
Copy-Item .\node_modules\@syncfusion\ej2-pdfviewer\dist\ej2-pdfviewer-lib -Destination .\src\ej2-pdfviewer-lib -Recurse -Force

Notes:

  • Run the command from the project root so the node_modules path resolves correctly.
  • Windows paths use backslashes (). Adjust paths if your project structure differs.
  • Ensure sufficient permissions to write to the destination folder.

For cross-platform scripts in package.json, consider tools such as “shx” or “copyfiles” to avoid OS-specific commands.