Terminal ➡️ Run task ➡️ 「tsc: watch - tsconfig.json」
> Executing task: tsc -p '/Users/macbook/Documents/demo/tsconfig.json' --watch <
env: node: No such file or directory
The terminal process "/bin/bash '-c', 'tsc -p '/Users/macbook/demo/tsconfig.json' --watch'" failed to launch (exit code: 127).Terminal will be reused by tasks, press any key to close it.
.
├── index.ts
├── js/
└── tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "./js",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
Hope someone can help me 😢
Does the same command work if you run it in the integrated terminal (tsc -p '/Users/macbook/demo/tsconfig.json' --watch) ?
Yes, the command works in terminal.
Can you share your tasks.json and your settings.json?
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"group": "build",
"label": "tsc: watch - tsconfig.json"
},
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
},
"label": "tsc: build- tsconfig.json"
}
]
}
settings.json
{
"editor.fontSize": 18,
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"emmet.triggerExpansionOnTab": true,
"emmet.syntaxProfiles": {
"JavaScript React": "jsx"
},
"easysass.formats": [{
"format": "expanded",
"extension": ".css"
},
{
"format": "compressed",
"extension": ".min.css"
}
],
"easysass.targetDir": "",
"window.zoomLevel": -1,
"editor.formatOnPaste": true,
"javascript.validate.enable": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"sync.gist": "token",
"sync.lastUpload": "2018-07-25T02:00:11.949Z",
"sync.autoDownload": false,
"sync.autoUpload": false,
"sync.lastDownload": "",
"sync.forceDownload": false,
"sync.host": "",
"sync.pathPrefix": "",
"sync.quietSync": false,
"sync.askGistName": false,
"sync.removeExtensions": true,
"sync.syncExtensions": true,
"editor.fontLigatures": true,
"workbench.statusBar.feedback.visible": false,
"materialTheme.fixIconsRunning": false,
"workbench.iconTheme": "vscode-icons",
"editor.snippetSuggestions": "top",
"[php]": {
},
"[json]": {},
"php-docblocker.extra": [],
"files.associations": {
"*.vue": "vue",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
"emmet.includeLanguages": {
"wxml": "html"
},
"minapp-vscode.disableAutoConfig": true,
"liveServer.settings.donotShowInfoMsg": true,
"php.suggest.basic": false,
"workbench.activityBar.visible": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.port": 5502,
"update.mode": "manual",
"vsicons.dontShowNewVersionMessage": true,
"[markdown]": {},
"editor.tabCompletion": "on",
"editor.tabSize": 3,
"workbench.colorTheme": "Electron vue",
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
"update.enableWindowsBackgroundUpdates": false,
"files.trimTrailingWhitespace": true,
"markdown-preview-enhanced.enableScriptExecution": true,
"prettier.arrowParens": "always",
"prettier.semi": true,
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"python.formatting.provider": "yapf",
"terminal.integrated.inheritEnv": false,
"python.formatting.blackPath": "yapf",
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"prettier.useTabs": true,
"prettier.tabWidth": 3,
"vetur.format.options.tabSize": 3,
"hediet.vscode-drawio.local-storage": "token",
"terminal.integrated.shell.osx": "/bin/bash",
"editor.renameOnType": true
}
Looks like this is the culprit: "terminal.integrated.inheritEnv": false,. If you set it to true then your issue will be resolved.
The same command works in the regular integrated terminal because that is an interactive and login shell. Tasks is not interactive, and not login which means that your bashrc and profile are not loaded.
Most helpful comment
Looks like this is the culprit:
"terminal.integrated.inheritEnv": false,. If you set it totruethen your issue will be resolved.The same command works in the regular integrated terminal because that is an interactive and login shell. Tasks is not interactive, and not login which means that your bashrc and profile are not loaded.