Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawn EPERM error on Windows if user does not have powershell access #2768

Closed
brytonpilling opened this issue Mar 12, 2024 · 8 comments
Closed
Labels
validated Version information for this issue has been validated

Comments

@brytonpilling
Copy link

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

When attempting to authorise and org on a machine that does not have Powershell access receive a spawn EPERM(1) error.

Steps To Reproduce

Attempt the command 'sf org login web' (you do not even need any further parameters) on a machine that does not have permission to run powershell, and the error spawn EPERM(1) is received.

Expected result

Web browser should open and allow an org to be authorised.

Actual result

spawn EPERM (1) error message

System Information

cmd.exe

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.30.8",
  "nodeVersion": "node-v20.11.1",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\c9003736\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.9 (core)",
    "@oclif/plugin-commands 3.1.4 (core)",
    "@oclif/plugin-help 6.0.13 (core)",
    "@oclif/plugin-not-found 3.0.11 (core)",
    "@oclif/plugin-plugins 4.2.5 (core)",
    "@oclif/plugin-search 1.0.16 (core)",
    "@oclif/plugin-update 4.1.13 (core)",
    "@oclif/plugin-version 2.0.12 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.12 (core)",
    "@oclif/plugin-which 3.1.0 (core)",
    "@salesforce/cli 2.30.8 (core)",
    "apex 3.0.25 (core)",
    "auth 3.3.13 (core)",
    "data 3.1.1 (core)",
    "deploy-retrieve 3.2.16 (core)",
    "info 3.0.27 (core)",
    "limits 3.1.10 (core)",
    "marketplace 1.0.25 (core)",
    "org 3.3.14 (core)",
    "packaging 2.1.10 (core)",
    "schema 3.1.3 (core)",
    "settings 2.0.27 (core)",
    "sobject 1.1.13 (core)",
    "source 3.1.15 (core)",
    "telemetry 3.1.13 (core)",
    "templates 56.0.16 (core)",
    "trust 3.3.10 (core)",
    "user 3.2.11 (core)"
  ]
}

Additional information

Error seems to be in the @salesforce/plugin-auth/node_modules/open/index.js file, lines 171,172,173, where the command is set to powershell without checking if powershell is accessible by the user. This appears to be the cause of the issue. Unsure whether there is an option to set this to CMD if powershell is blocked?

@brytonpilling brytonpilling added the investigating We're actively investigating this issue label Mar 12, 2024
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Mar 12, 2024
@shetzel
Copy link
Contributor

shetzel commented Mar 12, 2024

This has been reported in the past. Unfortunately, that's not code we own. It's the open library on npmjs. See this issue report on their github repo: sindresorhus/open#205

There might be something in that issue thread to workaround it or somehow use cmd.exe instead. Getting powershell access is the quickest way forward though.

@shetzel
Copy link
Contributor

shetzel commented Mar 12, 2024

The CLI currently uses open v9.1.0 and v10.1.0 was just released, and it looks like it addresses this. If you want to try it out temporarily, you could modify that file you mentioned so that line 172 looks like this:

${process.env.SYSTEMROOT || process.env.windir || 'C:\\Windows'}\\System32\\WindowsPowerShell\\v1.0\\powershell';

@shetzel shetzel added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Mar 12, 2024
Copy link

git2gus bot commented Mar 12, 2024

This issue has been linked to a new work item: W-15235605

@shetzel
Copy link
Contributor

shetzel commented Mar 12, 2024

The library will be updated in the next CLI release candidate being promoted tomorrow, but I don't think this will solve the problem for you. The best solution is to get access to powershell.

@brytonpilling
Copy link
Author

Thanks Shetzel! Certainly appreciate you looking into this one. I've requested Powershell access for the device in question - so that will likely fix the issue. If I get time I'll look into whether there is anyway for me to identify if powershell access is available and submit a fix to the open library on github.

@Saipraneeth-hub
Copy link

Saipraneeth-hub commented Mar 22, 2024

Hi Team,

Greetings!

Can anyone confirm whether we can try downgrading to v7.10.1 since this version is available on the node's official site which includes npm of 4.2.0. We are not able to find the exact version of node v7.1.0.

As one of my customers is from the banking sector, so according to RBI guidelines they are restricted from accessing the PowerShell. So they can't give access to the PowerShell due to company policies.

On a similar issue: sindresorhus/open#205 shared it shows one of the users has tried "downgrading to v7.1.0, and it works without giving access to PowerShell".

Thank You!

@cristiand391
Copy link
Member

@Saipraneeth-hub that comment referst to v7.10.1 of the open library, not the CLI or node.
.
Screenshot 2024-03-22 at 10 44 38

sfdx is deprecated and installing a 4y old version will probably not work as expected and/or even might include vulnerable dependencies.

@cristiand391 cristiand391 removed the bug Issue or pull request that identifies or fixes a bug label Mar 25, 2024
@cristiand391 cristiand391 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

4 participants