raviteja155's avatar

Cannot create symbolic link while building nativephp application

I am trying to build nativephp application on Windows and for Windows. During the build process, 'php artisan native:build win', I am getting the following error.

 Cannot create symbolic link : A required privilege is not held by the client. : C:\Users\ravi\AppData\Local\electron-builder\Cache\winCodeSign4287375\darwin.12\lib\libcrypto.dylib


command='D:\wamp64\www\attenbo\vendor\nativephp\electron\resources\js\node_moduleszip-bin\win\x64za.exe' x -bd 'C:\Users\ravi\AppData\Local\electron-builder\Cache\winCodeSign4287375.7z' '-oC:\Users\ravi\AppData\Local\electron-builder\Cache\winCodeSign4287375'
                    
workingDir=C:\Users\niraa\AppData\Local\electron-builder\Cache\winCodeSign
0 likes
3 replies
LaryAI's avatar
Level 58

The error you're encountering, "Cannot create symbolic link: A required privilege is not held by the client," typically occurs because creating symbolic links on Windows requires administrative privileges. Here are the steps to resolve this issue:

  1. Run Command Prompt as Administrator:

    • Close any open Command Prompt windows.
    • Open the Start Menu, type cmd, right-click on "Command Prompt," and select "Run as administrator."
    • Navigate to your project directory and run the build command again.
  2. Enable Developer Mode:

    • Open the Settings app.
    • Go to "Update & Security" > "For developers."
    • Enable "Developer mode." This allows the creation of symbolic links without needing to run as an administrator.
  3. Grant SeCreateSymbolicLinkPrivilege to Your User:

    • Press Win + R, type secpol.msc, and press Enter to open the Local Security Policy.
    • Navigate to "Local Policies" > "User Rights Assignment."
    • Find "Create symbolic links" and add your user account to this policy.
  4. Use mklink Command:

    • If the above steps do not work, you can manually create the symbolic link using the mklink command in an elevated Command Prompt. For example:
      mklink /D "C:\path\to\link" "C:\path\to\target"
      
  5. Check Electron-Builder Configuration:

    • Ensure that your electron-builder configuration does not have any misconfigurations that might be causing this issue. Sometimes, specifying the correct paths and ensuring all dependencies are correctly installed can help.

Here is a step-by-step example of running the build command as an administrator:

# Open Command Prompt as Administrator
# Navigate to your project directory
cd D:\wamp64\www\attenbo

# Run the build command
php artisan native:build win

By following these steps, you should be able to resolve the issue and successfully build your NativePHP application on Windows.

1 like
Vishal007's avatar

i have followed this step and successfully installed a window application but issue is when install and run then not my ui load when start project using php artisan native:serve and then also run a npm run dev then my ui is load and show correctoly but when create a build php artisan native:build then not ui is appear can any solution @LaryAI

1 like
raviteja155's avatar

I need to run the terminal/command prompt with administrator rights. 'Run as adminstrator.'

Please or to participate in this conversation.