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

Compilation didn't run at the launch of the extension (press F5) #510

Closed
Shankar-CodeJunkie opened this issue Oct 4, 2021 · 14 comments
Closed

Comments

@Shankar-CodeJunkie
Copy link

Shankar-CodeJunkie commented Oct 4, 2021

Problem Description:

I tried creating VS Code extension using the sample extension (yo code) provided in the documentation. I chose "typescript" as it's type of extension, while creating it.
When I tried to run the extension, I get an error message .

Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
Activating extension 'undefined_publisher.vscode-err-reproduce' failed: Cannot find module
 '/oct/vscode-extn-ts-error/vscode-err-reproduce/out/extension.js' Require stack: - /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js.

image

tsconfig.json

{
	"compilerOptions": {
		"module": "commonjs",
		"target": "ES2020",
		"outDir": "out",
		"lib": [
			"ES2020"
		],
		"sourceMap": true,
		"rootDir": "src",
		"strict": true   /* enable all strict type-checking options */
		/* Additional Checks */
		// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
		// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
		// "noUnusedParameters": true,  /* Report errors on unused parameters. */
	},
	"exclude": [
		"node_modules",
		".vscode-test"
	]
}

The problem is due to typescript compilation, and hence, I couldn't find extension.js file .

@Shankar-CodeJunkie
Copy link
Author

Shankar-CodeJunkie commented Oct 4, 2021

I manually ran tsc --watch to compile the typescript by adding the out attribute on the package.json. After that, I could launch the extension

@Shankar-CodeJunkie
Copy link
Author

However, my question is, why the compilation didn't run at the launch of the extension.

The product documentation says,
"Then, inside the editor, press F5. This will compile and run the extension in a new Extension Development Host window."
which isn't the case for my project.

@Shankar-CodeJunkie Shankar-CodeJunkie changed the title Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found) Compilation didn't run at the launch of the extension (press F5) Oct 4, 2021
@huse360
Copy link

huse360 commented Feb 4, 2022

I created the project inside a sub-folder and got this error, but closing VS Code and reopening the actual sub-folder worked for me.

@yu3wen
Copy link

yu3wen commented Feb 7, 2022

check your extension launch.json,make sure the follow code in your file
"preLaunchTask": "${defaultBuildTask}"

@bodoganabel
Copy link

Hi! This is still an issue.
Pressing F5 results the error above after creating a new project

@stereokai
Copy link

I can confirm this happens to me too with a Javascript extension generated with yeoman generator-code

@ljans
Copy link

ljans commented Jul 12, 2022

After updating to the latest VS Code version (1.69.1), it's now working for me.

@pgonzaleznetwork
Copy link

I got this to work by

  • updating to the latest version of vscode
  • run the yo command all over again
  • completely quitting vscode (not just closing it, kill the process)

Then it worked

@mjbvz
Copy link
Contributor

mjbvz commented Dec 5, 2022

Closing this as a question about extension development / no longer reproducible

@mjbvz mjbvz closed this as completed Dec 5, 2022
@Cway14
Copy link

Cway14 commented Dec 11, 2022

I experienced this issue today. Seems to be related to using webpack. I re-created the extension without webpack and no longer had issues.

@Brentably
Copy link

I am still having this issue.

@how2051
Copy link

how2051 commented Aug 18, 2023

I got this work by npm install -g typescript and then quit all the vscode and restart

@ehewitt-sel
Copy link

I just ran into this issue today, following the exact steps on the "Your First Extension" page: https://code.visualstudio.com/api/get-started/your-first-extension.

Not sure why this was closed, as it is still a problem. npm install -g typescript did not resolve the problem for me. Instead, I had to use the steps in the Stack Overflow question. https://stackoverflow.com/questions/69433540/vscode-extension-command-hello-world-resulted-in-an-error-command-vscode-er

@gareth-xlnx
Copy link

Confirming what @ehewitt-sel said - I have ran into the identical issue in VSCode 1.89.0 using the "Your First Extension" page: https://code.visualstudio.com/api/get-started/your-first-extension. Bug should be reopened.

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

No branches or pull requests