0

Can anyone please help?! I am unable to do Authorize org with VS Code. I have two orgs that are already authorized with VS Code, but I am not able to authorize a new org. It's throwing an error though I can deploy code on org, which is already authorized; only when I am trying to authorize with new org its throwing error.

Any Idea??? It would really as I block to do my priority assignment. Please help

below is error

Starting SFDX: Authorize an Org

08:13:15.856 sfdx org:login:web --alias vscodeOrg --instance-url https://login.salesforce.com --set-default
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for C:\Program Files\sf\client\bin\run. Loading extensionless files is not supported inside of "type":"module" package.json contexts. The package.json file C:\Program Files\sf\client\package.json caused this "type":"module" context. Try changing C:\Program Files\sf\client\bin\run to have a file extension. Note the "bin" field of package.json can point to a file with an extension, for example {"type":"module","bin":{"run":".\bin\run.js"}}
    at new NodeError (node:internal/errors:399:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:121:38)
    at defaultLoad (node:internal/modules/esm/load:81:20)
    at nextLoad (node:internal/modules/esm/loader:163:28)
    at ESMLoader.load (node:internal/modules/esm/loader:605:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
    at new ModuleJob (node:internal/modules/esm/module_job:64:26)
    at #createModuleJob (node:internal/modules/esm/loader:480:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Here is My package.json

Node.js v18.15.0
08:13:16.394 sfdx org:login:web --alias vscodeOrg --instance-url https://login.salesforce.com --set-default
 ended with exit code 1

{
  "name": "salesforce-app",
  "private": true,
  "version": "1.0.0",
  "description": "Salesforce App",
  "scripts": {
    "lint": "eslint **/{aura,lwc}/**",
    "test": "npm run test:unit",
    "test:unit": "sfdx-lwc-jest",
    "test:unit:watch": "sfdx-lwc-jest --watch",
    "test:unit:debug": "sfdx-lwc-jest --debug",
    "test:unit:coverage": "sfdx-lwc-jest --coverage",
    "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
    "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
    "postinstall": "husky install",
    "precommit": "lint-staged"
  },
  "devDependencies": {
    "@lwc/eslint-plugin-lwc": "^1.1.2",
    "@prettier/plugin-xml": "^2.0.1",
    "@salesforce/eslint-config-lwc": "^3.2.3",
    "@salesforce/eslint-plugin-aura": "^2.0.0",
    "@salesforce/eslint-plugin-lightning": "^1.0.0",
    "@salesforce/sfdx-lwc-jest": "^1.1.0",
    "eslint": "^8.11.0",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jest": "^26.1.2",
    "husky": "^7.0.4",
    "lint-staged": "^12.3.7",
    "prettier": "^2.6.0",
    "prettier-plugin-apex": "^1.10.0"
  },
  "lint-staged": {
    "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [
      "prettier --write"
    ],
    "**/{aura,lwc}/**": [
      "eslint"
    ]
  }
}

4
  • Could you include the contents of your package.json in your question? Have you followed the recommendation in the error message "Try changing..."? Commented Oct 27, 2023 at 9:23
  • I have added package.json in my question, error message I tried preforming some steps of troubleshooting with help of google but didn't work for me, please see if you could help if there is any issue with json file
    – Puja
    Commented Oct 27, 2023 at 10:17
  • This looks like the project package.json, not the C:\Program Files\sf\client\package.json mentioned. Which operating system do you have, - Windows? Commented Oct 27, 2023 at 10:38
  • yes windows 11, What steps should I perform and any changes in json, could you please help
    – Puja
    Commented Oct 27, 2023 at 12:10

1 Answer 1

0

@puja -Check if you have 2 "run" files created in "C:\Program Files\sf\client\bin\run." If yes, you can remove the one without any extension and keep run.js, If you only have one run file, you need to rename it to run.js. This should fix your issue. Please vote if this fixes your issue so that others can use the same.
enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .