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

Javascript HelloWorld shows error when running the hello world command #184

Closed
DoroNahari opened this issue Nov 20, 2019 · 9 comments
Closed
Assignees

Comments

@DoroNahari
Copy link

  • VSCode Version: 1.40.1
  • OS Version: macOs mojave 10.14.6

I generated new Javascript HelloWorld template and run it in vscode.
When i run the HelloWorld command, the command executes but i get an error:

Activating extension `vscode-samples1.helloworld-sample` failed:  Cannot find module '/Users/i348307/.vscode/extensions/vscode-samples1.helloworld-sample-0.0.1/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
extensionHostProcess.js:506
Here is the error stack:  Error: Cannot find module '/Users/i348307/.vscode/extensions/vscode-samples1.helloworld-sample-0.0.1/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
	at Function._resolveFilename (internal/modules/cjs/loader.js:627:15)
	at Function.<anonymous> (internal/modules/cjs/loader.js:531:27)
	at Function.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:796:719)
	at Function.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:765:302)
	at Function._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:761:870)
	at Module.require (internal/modules/cjs/loader.js:685:19)
	at require (internal/modules/cjs/helpers.js:16:16)
	at Function.s [as __$__nodeRequire] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:32:963)
	at d._loadCommonJSModule (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:766:484)
	at d._doActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:677:300)
	at d._activateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:676:360)
	at Object.actualActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:674:296)
	at Object._activateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:506:21)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:505:632
	at Array.map (<anonymous>)
	at Object._activateExtensions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:505:620)
	at Object.activateByEvent (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:503:413)
	at d._activateByEvent (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:675:24)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:683:293

Screen Shot 2019-11-20 at 12 09 45

@aeschli
Copy link
Contributor

aeschli commented Dec 4, 2019

Are you sure this was the Javascript sample? (Not the TypeScript sample)
The Javascript sample has the extension at vscode-samples1.helloworld-sample-0.0.1/extension.js (no out).

If this was in fact the Typescript sample, can you run npm install && npm run compile to see whether the compilation worked?

@delfu
Copy link

delfu commented Dec 17, 2019

i have the same issue with typescript version.

  1. running compile solves that issue but future changes are not watched
  2. when F5 there's a error The terminal process terminated with exit code: 127 with no additional info

@GaryBoone
Copy link

I'm seeing the same issue on my first attempt at following https://code.visualstudio.com/api/get-started/your-first-extension . I'm using typescript on Catalina. Like delfu@, running npm run compile solves it. And hitting F5, I see the exit code: 127 message.

If I do try to run the Hello World command in the new window, I see an error about "Can't find the extension" and see that it's referring to an out/ directory that doesn't exist before I manually compile.

How do I manually do what F5 does? Where is it configured? Where is its output? Where does it log? Other ideas?

@GaryBoone
Copy link

I installed npm with Homebrew. It seems that vscode shell commands such as the launch command aren't picking up the right path to include my brew/bin path, even though the interactive shell works. I checked process.env in devtools (Help|Toggle Developer Tools, then paste it into the Console tab), but it showed the correct path. I then tried copying the brew PATH export line from .bash_profile to a .bashrc file to run them in non-login shells. But that didn't work.

What did work was to add a new command line flag to tell vscode to run shells interactively. Do that by adding -i to the list of shell args in the terminal.integrated.shellArgs.osx preference.

@aeschli
Copy link
Contributor

aeschli commented Feb 18, 2020

To see what F5 runs. check the launch.json - preLaunchTask.
It's the default build task which is defined in tasks.json: npm run watch

@raulcesar
Copy link

I'm getting this same problem. Using Code-OSS version 1.42.0 on arch linux.
The preLaunchTask is set as "defaultBuildTask" wich is set to "watch". If I manually run watch (i.e yarn run watch or npm run watch), it works.

@raulcesar
Copy link

After much fiddling, I found the problem, at least in my system.
For the sake of context, I use arch linux and when installing nodejs with arch's package manager (pacman), npm is not automatically installed (as it is a separate package). Since I use yarn in my projects, i never bothered to install it. As this is the case, whe I used the yeoman generator to create my extension (yo code), I chose yarn as the package manager. However, it appears this only effects the way the generator will run the "install" of packages. Apparently there is still some dependency with NPM. My guess would be that it runs the scripts with npm.
When I installed npm, the issues went away.

@aeschli
Copy link
Contributor

aeschli commented Nov 13, 2020

Closing as I can't reproduce.

@aeschli aeschli closed this as completed Nov 13, 2020
@Aaronphy
Copy link

Aaronphy commented Feb 7, 2021

i have the same issue with typescript version.

  1. running compile solves that issue but future changes are not watched
  2. when F5 there's a error The terminal process terminated with exit code: 127 with no additional info

Any information ? solved?

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

6 participants