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

"Unable to load schema from '/Users/<user>/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json' #5840

Open
dschach opened this issue Sep 10, 2024 · 20 comments

Comments

@dschach
Copy link

dschach commented Sep 10, 2024

Summary

Error shown when viewing scratch org definition file or sfdx-project.json in VSCode.

(Note: I cannot find the /Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce folder on my MacOs computer. I found node_modules, but not @salesforce.)

Steps To Reproduce

I can't show a repository because this is not repository-based.

It happens in multiple projects, for multiple files. There is an error that says
Unable to load schema from '/Users/dschach/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json': ENOENT: no such file or directory, open '/Users/dschach/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json'.

It also happens when I open sfdx-project.json:
Unable to load schema from '/Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json': ENOENT: no such file or directory, open '/Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json'.

{
  "versionDetail": {
    "architecture": "darwin-arm64",
    "cliVersion": "@salesforce/cli/2.57.7",
    "nodeVersion": "node-v20.16.0",
    "osVersion": "Darwin 23.6.0",
    "rootPath": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
    "shell": "zsh",
    "pluginVersions": [
      "@oclif/plugin-autocomplete 3.2.2 (core)",
      "@oclif/plugin-commands 4.0.13 (core)",
      "@oclif/plugin-help 6.2.10 (core)",
      "@oclif/plugin-not-found 3.2.18 (core)",
      "@oclif/plugin-plugins 5.4.6 (core)",
      "@oclif/plugin-search 1.2.7 (core)",
      "@oclif/plugin-update 4.5.5 (core)",
      "@oclif/plugin-version 2.2.11 (core)",
      "@oclif/plugin-warn-if-update-available 3.1.13 (core)",
      "@oclif/plugin-which 3.2.12 (core)",
      "@salesforce/cli 2.57.7 (core)",
      "apex 3.4.5 (core)",
      "api 1.2.1 (core)",
      "auth 3.6.51 (core)",
      "code-analyzer 5.0.0-alpha.1 (user)",
      "data 3.6.3 (core)",
      "deploy-retrieve 3.12.0 (core)",
      "dev 2.4.2 (user)",
      "info 3.4.2 (core)",
      "limits 3.3.27 (core)",
      "marketplace 1.2.24 (core)",
      "org 4.5.4 (core)",
      "packaging 2.8.0 (core)",
      "schema 3.3.26 (core)",
      "settings 2.3.15 (core)",
      "sobject 1.4.32 (core)",
      "source 3.5.16 (core)",
      "telemetry 3.6.10 (core)",
      "templates 56.3.14 (core)",
      "trust 3.7.25 (core)",
      "user 3.5.26 (core)",
      "@salesforce/sfdx-scanner 4.5.0 (user)"
    ]
  },
  "sfdxEnvVars": [],
  "sfEnvVars": [
    [
      "SF_BINPATH",
      "/Users/myuser/.local/share/sf/client/bin/sf"
    ],
    [
      "SF_AUTOUPDATE_DISABLE",
      "true"
    ],
    [
      "SF_DISABLE_AUTOUPDATE",
      "true"
    ],
    [
      "SF_UPDATE_INSTRUCTIONS",
      "Use \"npm update --global @salesforce/cli\" to update npm-based installations."
    ]
  ],
  "proxyEnvVars": [],
  "cliConfig": {
    "arch": "arm64",
    "bin": "sf",
    "binAliases": [
      "sfdx"
    ],
    "binPath": "/Users/myuser/.local/share/sf/client/bin/sf",
    "cacheDir": "/Users/myuser/Library/Caches/sf",
    "channel": "stable",
    "configDir": "/Users/myuser/.config/sf",
    "dataDir": "/Users/myuser/.local/share/sf",
    "dirname": "sf",
    "flexibleTaxonomy": true,
    "home": "/Users/myuser",
    "isSingleCommandCLI": false,
    "name": "@salesforce/cli",
    "nsisCustomization": "scripts/nsis.nsi",
    "platform": "darwin",
    "root": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
    "shell": "zsh",
    "theme": {
      "bin": "blueBright",
      "command": "blueBright",
      "dollarSign": "green",
      "flag": "green",
      "flagDefaultValue": "blueBright",
      "flagOptions": "blueBright",
      "flagRequired": "red",
      "sectionHeader": "blue",
      "topic": "blueBright",
      "json": {
        "brace": "whiteBright",
        "bracket": "whiteBright",
        "comma": "green",
        "key": "blueBright",
        "string": "greenBright",
        "number": "blue",
        "boolean": "redBright",
        "null": "blackBright"
      }
    },
    "topicSeparator": " ",
    "updateConfig": {
      "s3": {
        "bucket": "dfc-data-production",
        "host": "https://developer.salesforce.com",
        "templates": {
          "target": {
            "baseDir": "<%- bin %>",
            "manifest": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>",
            "unversioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>",
            "versioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>"
          },
          "vanilla": {
            "baseDir": "<%- bin %>",
            "manifest": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %>version",
            "unversioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %><%- ext %>",
            "versioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %><%- ext %>"
          }
        }
      },
      "node": {}
    },
    "userAgent": "@salesforce/cli/2.57.7 darwin-arm64 node-v20.16.0",
    "valid": true,
    "version": "2.57.7",
    "warned": false,
    "windows": false,
    "_base": "@oclif/[email protected]",
    "_commands": {},
    "_topics": {},
    "commandPermutations": {
      "validPermutations": {}
    },
    "pluginLoader": {
      "options": {
        "root": "/Users/myuser/.local/share/sf/client/2.57.7-291554e/dist"
      },
      "errors": [],
      "plugins": {},
      "pluginsProvided": false
    },
    "topicPermutations": {
      "validPermutations": {}
    },
    "nodeEngine": ">=18.6.0"
  },
  "pluginSpecificData": {
    "@salesforce/plugin-deploy-retrieve": [
      {
        "sourceApiVersion": "61.0",
        "targetDevHubApiVersion": "61.0",
        "targetOrgApiVersion": "61.0"
      }
    ],
    "@salesforce/plugin-auth": [
      {
        "isUsingGenericKeychain": false,
        "sfCryptoV2Support": false,
        "cryptoVersion": "unknown"
      }
    ]
  },
  "diagnosticResults": [
    {
      "testName": "salesforcedx plugin isn’t installed",
      "status": "pass"
    },
    {
      "testName": "you don't have any linked plugins",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.npmjs.org",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.npmjs.org/",
      "status": "pass"
    },
    {
      "testName": "using latest or latest-rc CLI version",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] default target DevHub max apiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] sourceApiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "can access: https://test.salesforce.com",
      "status": "pass"
    },
    {
      "testName": "can access: https://appexchange.salesforce.com/services/data",
      "status": "pass"
    },
    {
      "testName": "can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-auth] CLI supports v2 crypto",
      "status": "fail"
    }
  ],
  "suggestions": [
    "Check https://github.com/forcedotcom/cli/issues for CLI issues posted by the community.",
    "Check http://status.salesforce.com for general Salesforce availability and performance.",
    "using npm registry https://registry.npmjs.org/ from npm config",
    "Your current installation of Salesforce CLI, including all the plugins you've linked and installed, doesn't yet support v2 crypto. All plugins and libraries must use at least version 6.7.0 of `@salesforce/core` to support v2 crypto. You're generally still able to successfully authenticate with your current CLI installation, but not if you generate a v2 crypto key."
  ],
  "logFilePaths": [],
  "commandExitCode": 0
}

Expected result

Actual result

Additional information

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.57.7",
  "nodeVersion": "node-v20.16.0",
  "osVersion": "Darwin 23.6.0",
  "rootPath": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.2 (core)",
    "@oclif/plugin-commands 4.0.13 (core)",
    "@oclif/plugin-help 6.2.10 (core)",
    "@oclif/plugin-not-found 3.2.18 (core)",
    "@oclif/plugin-plugins 5.4.6 (core)",
    "@oclif/plugin-search 1.2.7 (core)",
    "@oclif/plugin-update 4.5.5 (core)",
    "@oclif/plugin-version 2.2.11 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.13 (core)",
    "@oclif/plugin-which 3.2.12 (core)",
    "@salesforce/cli 2.57.7 (core)",
    "apex 3.4.5 (core)",
    "api 1.2.1 (core)",
    "auth 3.6.51 (core)",
    "code-analyzer 5.0.0-alpha.1 (user) published 14 days ago (Tue Aug 27 2024)",
    "data 3.6.3 (core)",
    "deploy-retrieve 3.12.0 (core)",
    "dev 2.4.2 (user) published 14 days ago (Mon Aug 26 2024)",
    "info 3.4.2 (core)",
    "limits 3.3.27 (core)",
    "marketplace 1.2.24 (core)",
    "org 4.5.4 (core)",
    "packaging 2.8.0 (core)",
    "schema 3.3.26 (core)",
    "settings 2.3.15 (core)",
    "sobject 1.4.32 (core)",
    "source 3.5.16 (core)",
    "telemetry 3.6.10 (core)",
    "templates 56.3.14 (core)",
    "trust 3.7.25 (core)",
    "user 3.5.26 (core)",
    "@salesforce/sfdx-scanner 4.5.0 (user) published 14 days ago (Tue Aug 27 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.

@iowillhoit
Copy link

This would be owned by the VSCode extensions team. I will transfer it over.

I am not seeing any other reports of this on their Issues repo so it could be a bad install? I would try fully uninstalling (and reinstalling) the VSCode extensions and the CLI.

@iowillhoit iowillhoit transferred this issue from forcedotcom/cli Sep 11, 2024
@diyer
Copy link
Collaborator

diyer commented Sep 12, 2024

@dschach Please follow these steps
For Mac and Linux, run the following:

  1. which sfdx
  2. which sf
  3. sfdx --version
  4. sf --version

For Windows, run the following:

  1. where sfdx
  2. where sf
  3. sfdx --version
  4. sf --version

If you have two different versions for sfdx --version and sf --version, follow these instructions to uninstall the CLI from both the installer and NPM, then reinstall the latest version of the CLI using one of those methods.

@diyer diyer added the waiting for user Use this label when you are waiting for some action to be taken by the user label Sep 12, 2024
@dschach
Copy link
Author

dschach commented Sep 13, 2024

/usr/local/bin/sfdx
/usr/local/bin/sf
sfdx --version
@salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0
sf --version
@salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

@Telfie70
Copy link

Telfie70 commented Sep 14, 2024

Hi

I am experiencing the same issue with my setup. I have downgraded the package as was suggested on stackexchange but no change.

Have tried using the expanded pack with the same result.

image

image

which sfdx
/usr/local/bin/sfdx

which sf
/usr/local/bin/sf

sfdx --version
@salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

sf --version
@salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

@daphne-sfdc
Copy link
Contributor

@dschach @Telfie70 Can you try cleaning out all the existing and old versions of your Salesforce extensions in VSCode and then reinstalling the extensions?

This is how to do that:

  1. In Teminal, go to .vscode/extensions from the home directory.
  2. Run rm -rf salesforce.salesforcedx* to delete all the Salesforce extensions.
  3. Quit and reopen VSCode.
  4. Reinstall the latest version of the Salesforce extensions.

@YavuzCemal
Copy link

YavuzCemal commented Sep 16, 2024

Hi @daphne-sfdc
I also have the same issue.
I run the codes you told in the git bash, cleared all extensions and re-installed them. Still have the issue.

where sfdx
C:\Program Files\sf\bin\sfdx
C:\Program Files\sf\bin\sfdx.cmd

where sf
C:\Program Files\sf\bin\sf
C:\Program Files\sf\bin\sf.cmd

sfdx version
sf version
@salesforce/cli/2.58.7 win32-x64 node-v20.17.0

@daphne-sfdc
Copy link
Contributor

@YavuzCemal Please go to your User settings.json and add "json.schemas": [] to the end of that file, then reload the VSCode window. Let me know if that fixes the issue!

@YavuzCemal
Copy link

@daphne-sfdc problem solved. ty.

@daphne-sfdc
Copy link
Contributor

@YavuzCemal Great to hear your problem is now resolved! 🎊

@dschach @Telfie70 If cleaning and reinstalling your extensions doesn't work, please also try adding "json.schemas": [] to your User settings.json.

@dschach
Copy link
Author

dschach commented Sep 17, 2024

@daphne-sfdc Did all that. Deleted directory. Installed extended pack. Got an error that one of the extensions requires the regular pack. Installed the regular pack as well. Added json.schema to settings.
Opened project-scratch-def.json and still got the error.

It's asking for a folder called @salesforce and that's what isn't present.

@daphne-sfdc
Copy link
Contributor

@dschach

Two questions:

  1. Are you seeing this as a warning or error?
  2. How does this affect your day-to-day operations, other than it showing up in the Problems tab and being annoying?

I see a warning in my Problems tab and everything was working fine for me, so I was wondering about the impact of this issue from your side.
Screenshot 2024-09-17 at 11 47 33 AM

@dschach
Copy link
Author

dschach commented Sep 17, 2024

It's not a blocker, but it's there and I figured the team would like to know :)
It's orange, so a warning, I think.
I'm still able to do my work - just unsure why it's happening and what part of the extension pack is looking for something that's not there.
Thanks for looking into this

@daphne-sfdc daphne-sfdc added type:bug and removed waiting for user Use this label when you are waiting for some action to be taken by the user labels Sep 17, 2024
Copy link

git2gus bot commented Sep 17, 2024

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

@daphne-sfdc
Copy link
Contributor

daphne-sfdc commented Sep 17, 2024

Hello everyone, Multiple members of our team are seeing this warning, and we have concluded that it is a bug. We'll keep you updated on the status of fixing this bug in this issue.

@Telfie70
Copy link

Hi @daphne-sfdc

I have removed the files and then reinstalled and still got the error.

I added "json.schemas": [] and still got the error

Unable to load schema from '/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json': ENOENT: no such file or directory, open '/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json'.

I was able to authorise the org so it might be ok functionality wise but will only find out for sure once I start getting into the details.

@Zosoled
Copy link

Zosoled commented Oct 31, 2024

This issue is not resolved with "json.schemas": [] for me either.

@j-schreiber
Copy link

j-schreiber commented Nov 11, 2024

I have been able to resolve this by simply adding the schemas manually to the extension folders. I can confirm, that there is no @salesforce/schemas in the relevant folder.

I used the schemas from the official schemas repo - no clue if there is a more up-to-date version.

❗ Snippets written for Mac, but should be easy to adapt to Windows/Linux. Obviously, you need to copy the exact location that it is looking for - replace Jannis.Schreiber with your username and 62.3.1 with your extension version. I basically copied the path from the inline error message that is thrown by VS Code.

SFDX Project Schema

wget https://raw.githubusercontent.com/forcedotcom/schemas/refs/heads/main/sfdx-project.schema.json && mv sfdx-project.schema.json /Users/Jannis.Schreiber/.vscode/extensions/salesforce.salesforcedx-vscode-core-62.3.1/node_modules/@salesforce/schemas/sfdx-project.schema.json

Scratch Def Schema

wget https://raw.githubusercontent.com/forcedotcom/schemas/refs/heads/main/project-scratch-def.schema.json && mv project-scratch-def.schema.json /Users/Jannis.Schreiber/.vscode/extensions/salesforce.salesforcedx-vscode-core-62.3.1/node_modules/@salesforce/schemas/project-scratch-def.schema.json

✅ Restart VS Code and you should be ready. Here's a screenshot with working auto-complete from the schema.

image

@anthonygiuliano
Copy link

@j-schreiber solution works although I assume it will have to be repeated each time the extension is updated. So weird that it's looking for these files in a directory that doesn't exist.

@dougcrew
Copy link

@j-schreiber I went through this process and I am no longer getting the same error. But now I am getting an "Unable to parse content from (followed by the path)" error.

Did you by any chance encounter this?

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

No branches or pull requests

10 participants