microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.76k stars 29.47k forks source link

[Insiders-Regression] zsh:1: command not found: tsc The terminal process terminated with exit code: 127 #85753

Closed admmasters closed 4 years ago

admmasters commented 5 years ago

I'm noting this behaviour as it has occurred in the insiders build for a few releases now.

Steps to Reproduce:

  1. Try running a task (tsc watch in this instance) using the task menu
  2. Observe issue

Does this issue occur when all extensions are disabled?: Yes

admmasters commented 5 years ago

Note this only occurs with a locally installed typescript - seems whatever new behaviour has been introduced relies upon a globally installed typescript which is not great practice at all.

RobertoMalatesta commented 4 years ago

Confirm the issue on Linux as well (Kubuntu 18.04). vsc does not finds tsc command if node is per-user nvm-installed.

image

R

mjbvz commented 4 years ago

Here's the logic we use to look up the tsc path: https://github.com/microsoft/vscode/blob/cf197953d7c65b4131147d93cf0dc7766a610b70/extensions/typescript-language-features/src/features/task.ts#L183

Note that is prefers using the local tsc installed under node_modules. How do you have tsc installed?

RobertoMalatesta commented 4 years ago

Hi @mjbvz

How do you have tsc installed?

I have tried with both. > Executing task: /home/robi/src2/industry40/node_modules/.bin/tsc -p /home/robi/src2/industry40/tsconfig.json --watch < /usr/bin/env: ‘node’: No such file or directory The terminal process terminated with exit code: 127 It seems that newer versions of VSC don't read .bashrc before opening the internal terminal or it's read async. If I open an integrated terminal and type the "tsc -p ... --watch" command line myself, the compiler executes.

Node Version: 13.2.0 TS Version: 3.8.0-dev.20191128

R

alexr00 commented 4 years ago

VS Code tasks have never read the .bashrc. By default, tasks run -c , and the -c flag means that the shell is non-interactive and non-login. Tasks usually do inherit the environment that VS Code has though. Something similar happened over in #85714. Do you have "terminal.integrated.inheritEnv": false set? That would cause this behavior.

RobertoMalatesta commented 4 years ago

Do you have "terminal.integrated.inheritEnv": false set? That would cause this behavior.

It is set to true.

alexr00 commented 4 years ago

Can you share your tasks.json if you have one and all of your settings.json files?

RobertoMalatesta commented 4 years ago

Can you share your tasks.json if you have one and all of your settings.json files?

@alexr00 Yes. I'll have to edit out some info for security and non-disclosure reasons.

The key point I think is the error line reported in the internal terminal when opened with ^B: /usr/bin/env: ‘node’: No such file or directory If I open a new internal terminal ("+") and issue: tsc -p tsconfig.json or tsc -p tsconfig.json --watch

tsc executes.

R

RobertoMalatesta commented 4 years ago

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "option": "watch",
            "problemMatcher": [
                "$tsc-watch"
            ]
        }
    ]
}

tsconfig.json:


{
  "compilerOptions": {

    "incremental": true,

    "target": "es5",                       
    "module": "amd",                 
    "lib": [
      "es6",
      "dom",
      "es2015.iterable"
    ], 
    "allowJs": true, 
    "sourceMap": true,                  
    "outFile":  <cut>, 
    "outDir":  <cut>
    "strict": true,                   
    "esModuleInterop": true ,               
    "inlineSourceMap": false,              
    "inlineSources": false,                

  },
  "files": [
  <cut>
  ],
  "include": [
  <cut>
  ],
  "exclude": [
  <cut>
  ] 
}
admmasters commented 4 years ago

The other key thing to note here is that this is 100% working on the normal channel so whatever change in behaviour has been introduced is recent and unique to the insiders channel.

alexr00 commented 4 years ago

Can you share your settings.json?

admmasters commented 4 years ago
{
    "cSpell.words": [
        "persistor"
    ],
    "typescript.tsdk": "node_modules/typescript/lib"
}
admmasters commented 4 years ago

{
    "npm.packageManager": "yarn",
    "explorer.confirmDelete": false,
    "explorer.confirmDragAndDrop": false,
    "typescript.updateImportsOnFileMove.enabled": "always",
    "editor.codeActionsOnSave": {
        "source.fixAll": true,
        "source.organizeImports": true
    },
    "editor.tabSize": 2,
    "editor.renderWhitespace": "all",
    "javascript.updateImportsOnFileMove.enabled": "always",
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "workbench.iconTheme": "material-icon-theme",
    "editor.formatOnSave": true,
    "editor.fontFamily": "Source Code Pro for Powerline",
    "workbench.colorTheme": "Winter is Coming (Dark Blue - No Italics)",
    "editor.suggestSelection": "first",
    "sync.gist": "5f44767f3b5aaa317b0ea5151cae465d",
    "go.useLanguageServer": true,
    "typescript.preferences.quoteStyle": "single",
    "typescript.preferences.importModuleSpecifier": "relative",
    "eslint.alwaysShowStatus": true,
    "eslint.autoFixOnSave": true,
    "eslint.packageManager": "yarn",
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
    ],
    "window.zoomLevel": 0,
    "terminal.integrated.inheritEnv": true
}
hilleer commented 4 years ago

Had this same issue popping up after updating vscode to version 1.41.0, while it has been working perfectly fine until then.

Running on macOS Catalina version 10.15.2.

RobertoMalatesta commented 4 years ago

he other key thing to note here is that this is 100% working on the normal channel

On Linux the same issue is present in 1.40.02 stable.

jimisaacs commented 4 years ago

Same behavior Version: 1.41.0 was working fine yesterday.

MJRasmussen commented 4 years ago

Same behavior Version: 1.41.0 was working fine yesterday.

Had to downgrade it: https://code.visualstudio.com/updates/v1_40 to solve it.

alexr00 commented 4 years ago

Can anyone who's seeing this share the full terminal output from the task?

alexr00 commented 4 years ago

Found the issue: cf197953d7c65b4131147d93cf0dc7766a610b70 On linux (and maybe others, just not Windows). the stat.type of the node_modules/.bin/tsc is 65, which isn't vscode.FileType.File (that's actually `).

jrieken commented 4 years ago

The FileStat#type property is a bitmask, so 65 is a sym-link to a file (1 /file/ + 64 /symlink/)

alexr00 commented 4 years ago

Yup, today's the first time I've ever looked at our FileStat API so I read the documentation :)

hilleer commented 4 years ago

Can anyone who's seeing this share the full terminal output from the task?

@alexr00 what do you need exactly? The error I get is the same as the one @RobertoMalatesta posted already here: https://github.com/microsoft/vscode/issues/85753#issuecomment-560177248.

sandy081 commented 4 years ago

Discussed in our standup and agreed to be included for November Recovery.

hilleer commented 4 years ago

Can confirm this is again working for me with vscode version 1.41.1.

RobertoMalatesta commented 4 years ago

1.41.1 : same problem persists: image

RobertoMalatesta commented 4 years ago

... same happens with latest insider. image

RobertoMalatesta commented 4 years ago

A temporary remedy is to create a link that env can see. in my case: ln -s /home/robi/.nvm/versions/node/v13.2.0/bin/node /usr/local/bin/node But it's an ugly patch and I hate ugliness.

Merry X-Mas, --R

humansthatmake commented 4 years ago

Having a similar issue. Here I tried to run make as a task: Screenshot 2020-01-07 at 21 31 07

Here I tried to run make in a different integrated terminal session: Screenshot 2020-01-07 at 21 37 49

And the operation was successful. It was able to find the path and run.

It seems like when I run a task the new terminal session is stripped out of any user configurations and starts running a factory version of the terminal.

VSCode: 1.41.1 macOS 10.14.6

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "includePath": [
                "${workspaceRoot}/main/**",
                "${workspaceRoot}/build/include/",
                "${env:IDF_PATH}/components/**"
            ],

            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

settings.json

{
    "C_Cpp.updateChannel": "Insiders",
    "workbench.editor.highlightModifiedTabs": true,
    "editor.acceptSuggestionOnEnter": "off",
    "files.trimFinalNewlines": true,
    "terminal.integrated.env.osx": 
    {
        "PATH": "$HOME/esp/xtensa-esp32-elf/bin:$PATH"
    }
}
alexr00 commented 4 years ago

Please open a new issue since this isn't a problem with typescript task detection.

humansthatmake commented 4 years ago

done. https://github.com/microsoft/vscode/issues/88290

Thank you @alexr00