salesforcedx-vscode: "Unable to load schema from '/Users//.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json'
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/core@4.0.19",
"_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)"
]
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (6 by maintainers)
I have been able to resolve this by simply adding the
schemasmanually to the extension folders. I can confirm, that there is no@salesforce/schemasin 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.Schreiberwith your username and62.3.1with your extension version. I basically copied the path from the inline error message that is thrown by VS Code.SFDX Project Schema
Scratch Def Schema
✅ Restart VS Code and you should be ready. Here’s a screenshot with working auto-complete from the schema.
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.
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 problem solved. ty.