Skip to content

Failed to launch external program tsc -w -p .. spawn tsc ENOENT #8434

@normalser

Description

@normalser
  • VSCode Version: Version 1.3.0-insider (1.3.0-insider) d0c2b89
  • OS Version: OSX 10.11.5

Steps to Reproduce:

  1. Open VSCode insider from Finder (not from terminal)
  2. Try to run build task (that is using tsc -w)
  3. I'm using nvm so proper PATH needs to be set eg . ~/.nvm/...

This is similar to #7343 or even identical. Commit 1a7c54e does not fix this issue for me.

When I start VSCode from Finder and open devtools then process.env.PATH == "/usr/bin:/bin:/usr/sbin:/sbin". When I start VSCode from terminal then it has my proper process.env.PATH == "/Users/wallverb/.nvm/versions/node/v4.2.2/bin:/opt/local/bin:.........."

When I run this code in devtools:

const electron = "/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron";
const cp = require('child_process');
const env = Object.assign({}, process.env, {
    ATOM_SHELL_INTERNAL_RUN_AS_NODE: '1',
    ELECTRON_NO_ATTACH_CONSOLE: '1'
});
const command = `'${electron}' -p 'JSON.stringify(process.env)'`;
const result = cp.spawnSync(process.env.SHELL, ['-ilc', command], {
    detached: true,
    stdio: ['ignore', 'pipe', process.stderr],
    env,
    encoding: 'utf8'
});
console.log(result.stdout.match(/"PATH":"(.*?)"/)[1])

// const strip = s => s.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '').replace(/\u001b\].*?\u0007/g, '');
//console.log(JSON.parse(result.stdout));  // would throw parse error

Then proper path is returned : "/Users/wallverb/.nvm/versions/node/v4.2.2/bin:/opt/local/bin:.........."

but the problem is that my interactive shell returns some "intro message" (eg. zsh -ilc env will return INTRO_MESSAGE\nwalverb which will of course break JSON.parse() in above code. I wonder why is 1.2.0 working fine and it's only problem with 1.3.0-insider

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions