GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(windows): avoid EPERM rename error during platform project creation by dyazincahya · Pull Request #6066 · NativeScript/nativescript-cli

Conversation

@dyazincahya

@dyazincahya dyazincahya commented Jun 29, 2026

Copy link
Copy Markdown

PR Checklist

  • The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages.
  • There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
  • You have signed the CLA.
  • All existing tests are passing: https://github.com/NativeScript/nativescript-cli/blob/master/CONTRIBUTING.md#contribute-to-the-code-base
  • Tests for the changes are included.

What is the current behavior?

When adding the windows platform to a project on Windows OS, the NativeScript CLI copies the platform template into a directory named __PROJECT_NAME__ under platforms/windows/, and subsequently attempts to rename it to the actual project name using Node's fs.rename function.

However, because background OS processes (such as Windows Defender real-time protection, search indexers, or antivirus scanners) instantly inspect/lock newly created folders, this immediate directory rename fails with a persistent EPERM: operation not permitted error, causing the platform setup command to crash.

What is the new behavior?

  1. Direct Copy Bypass: Modified the createProject function in windows-project-service.ts to copy the template directory directly using the target project name from the start. This completely eliminates the directory rename step (__PROJECT_NAME__ -> projectDir), bypassing the EPERM lock on the folder.
  2. Permissions Cleanup: Added a recursive clearReadOnlyRecursive helper using fs.chmodSync to strip any read-only properties from the platform project files on Windows before editing.
  3. Retry rename utility: Added a renameWithRetry utility featuring a 30-retry loop (with 300ms delays) to gracefully handle transient locks when renaming internal project files, such as the .csproj file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dyazincahya
fix(windows): avoid EPERM rename error during platform project creation
e5ef0ac
EPERM: operation not permitted, rename 'C:\Users\....\DataDisk\projects\kang-cahya\nativescript\windows\nativescript-windows-pokedex\platforms\windows\__PROJECT_NAME__' -> 'C:\Users\....\DataDisk\projects\kang-cahya\nativescript\windows\nativescript-windows-pokedex\platforms\windows\nativescriptwindowspokedex'
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 82241bef-48da-471b-8f23-b6f0f20a15bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

triniwiz
triniwiz approved these changes Jun 29, 2026
View reviewed changes
triniwiz
triniwiz approved these changes Jul 10, 2026
View reviewed changes
@triniwiz
triniwiz merged commit ea72c74 into NativeScript:feat/windows Jul 12, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@triniwiz triniwiz triniwiz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@dyazincahya @triniwiz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.