question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Code fails to create new Apex Class stub on Windows 11 insider preview version

See original GitHub issue

Longtime VS Code user and been using VS Code / SFDX on multiple computers for over a year. I’ve just installed VS Code and the SFDX CLI on a new computer, and now I cannot use the VS Code command palette to create a new Apex Class.

The output I get is: Trying to copy from a source that does not exist: c:\Users\xxxxxxxxxx\.vscode\extensions\salesforce.salesforcedx-vscode-core-52.4.0\node_modules\@salesforce\templates\lib\templates\apexclass\DefaultApexClass.cls

But what’s funny is that the files do exist (screenshot) image

Operating System: Windows 11 (Insider Preview, build 22000.65)

Version: 1.58.0 (user setup) Commit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6 Date: 2021-07-08T06:54:55.083Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.22000

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jarodwsamscommented, Jul 29, 2021

I’m also seeing other SFDX cli command stubs fail. Today it’s failing to run “SFDX: Create Project”. Unlike my original issue, however, the base cli command also fails.

AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\templates\project\standard\ScratchDef.json
    at EditionInterface.exports.copy (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy.js:49:3)
    at EditionInterface.module.exports [as copyTpl] (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:29:8)
    at ProjectGenerator.writing (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\generators\projectGenerator.js:63:17)
    at Object.<anonymous> (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:427:27)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:49:25
    at new Promise (<anonymous>)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:26:19
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:428:13
    at processImmediate (internal/timers.js:464:21) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}
AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\templates\project\standard\ScratchDef.json
    at EditionInterface.exports.copy (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy.js:49:3)
    at EditionInterface.module.exports [as copyTpl] (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:29:8)
    at ProjectGenerator.writing (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\generators\projectGenerator.js:63:17)
    at Object.<anonymous> (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:427:27)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:49:25
    at new Promise (<anonymous>)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:26:19
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:428:13
    at processImmediate (internal/timers.js:464:21) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}
AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\templates\project\standard\ScratchDef.json
    at EditionInterface.exports.copy (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy.js:49:3)
    at EditionInterface.module.exports [as copyTpl] (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:29:8)
    at ProjectGenerator.writing (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\@salesforce\templates\lib\generators\projectGenerator.js:63:17)
    at Object.<anonymous> (C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:427:27)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:49:25
    at new Promise (<anonymous>)
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\run-async\index.js:26:19
    at C:\Users\user\AppData\Local\sfdx\client\7.110.0-85b006b\node_modules\yeoman-generator\lib\index.js:428:13
    at processImmediate (internal/timers.js:464:21) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}```
0reactions
randi274commented, Apr 4, 2022

Thanks for confirming @jarodwsams - we actually have one open item to trim spaces at the end of new projects (#3950), but this does seem to be a recurring theme for us resulting in certain mysterious issues 👻 . I’ll bring this up to the dev/docs team and see if there’s anything we can do to prevent these going forward. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix the error on deploying the apex classes using VS ...
The error means you're missing a metadata file. On the file explorer, click on the New File button, and name it:
Read more >
insider build is stuck - Microsoft Community Hub
i dont believe my insider build is working properly.
Read more >
SFDX: Deploy Source to Org failed to run in VS Code
I have been trying to deploy apex classes to a Trailhead Playgound as well as a developer org, but I receive the error...
Read more >
VSCode Implement Method Shortcut - Stack Overflow
Update: The shortcut in VsCode for accessing this quick action is the usual one: Ctrl + . (period) ...
Read more >
Overview of SQL Developer 1.5 - Oracle
It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found