How to Fix OneDrive and Visual Studio Code Sync and Performance Issues
Question details
A React or Node.js TypeScript project fails to sync, compile, or run correctly in Visual Studio Code after being moved to OneDrive.

- Product
- OneDrive and Visual Studio Code
- Device & OS
- Windows
- Scenario
- Developing Node.js or React applications in Visual Studio Code on a Windows machine where OneDrive backup is enabled for the Desktop or Documents folders.
- Observed behavior
- Visual Studio Code compiles indefinitely, npm start takes several minutes, files show unreadable code, and extensions appear missing due to incomplete OneDrive sync or Files On-Demand placeholders.
Ensure your device has an active and stable internet connection to complete any pending OneDrive syncs, and close Visual Studio Code completely before modifying or moving your project directories.
Move the Project Outside of OneDrive and Reinstall Dependencies
Relocating your development project to a local directory prevents OneDrive from constantly syncing thousands of node_modules files, which degrades Visual Studio Code performance.
OneDrive is not designed to handle the massive number of small files generated by Node.js projects. Moving the project to a non-synced local folder is the most reliable way to restore compiler speeds and prevent file corruption.
Open File Explorer, navigate to your local drive (e.g., C:\), and create a new folder specifically for development, such as C:\Dev.
Locate your broken project inside the OneDrive folder, copy the entire project folder, and paste it into your new local development directory.
In the new local directory, delete the node_modules folder and the package-lock.json file to clear any corrupted or incorrectly linked dependencies.
Open the newly copied project folder in Visual Studio Code, open the integrated terminal, and run npm install to download fresh dependencies.
Run npm start to verify that the indefinite compilation issue is resolved and performance has returned to normal.

Force OneDrive to Keep Project Files Locally
If you must keep the project in a OneDrive-managed folder, use the 'Always keep on this device' feature to prevent Files On-Demand from causing compilation delays.
Restore Damaged Files from OneDrive Version History
If specific project files display unreadable code or are corrupted after a Windows update or sync failure, restore a previous working version.
Avoid Sync Frustrations with WPS Office
If Microsoft 365 and OneDrive sync issues are interrupting your workflow, consider switching to WPS Office. It provides a lightweight, highly compatible, and user-friendly experience for all your document creation needs without forcing unwanted automatic cloud backups of your critical local folders.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the application: Run the installer and follow the on-screen instructions to quickly set up WPS Office on your device.
- 3. Open and edit your files: Easily open your existing Word, Excel, and PowerPoint documents directly in WPS Office with full formatting preserved.

Frequently Asked Questions
Why does npm start take several minutes when my project is in OneDrive?
OneDrive's 'Files On-Demand' feature offloads files to the cloud to save space. When a build tool like Webpack tries to read thousands of files in your node_modules folder, OneDrive has to download them on the fly, causing massive delays and indefinite compilation times.
How can I stop OneDrive from automatically syncing my Desktop and Documents?
Open OneDrive settings by clicking its icon in the taskbar, go to 'Sync and backup', click 'Manage backup', and toggle off the specific folders (like Desktop or Documents) that you no longer want OneDrive to automatically back up to the cloud.
Can I tell OneDrive to ignore the node_modules folder?
Unfortunately, OneDrive does not currently have a reliable built-in feature to ignore specific subfolders (like a .gitignore file does for Git). The standard best practice is to move your entire development project to a local directory outside of the OneDrive path.
How do I fix missing image extensions after a OneDrive sync issue?
Open File Explorer, go to the 'View' tab, and ensure 'File name extensions' is checked. If the files were actually corrupted during the sync process, right-click the affected file and use OneDrive's 'Version history' to restore a previously working copy.




