Skip to content

npm is not recognized in the tasks.json #58886

@hannah23280

Description

@hannah23280

Node js used: v10.8.0
electon : v2.0.7
VScode IDE: v1.25.1
OS: window 10

Currently, i have a launch configuration with preLaunchTask set to "RunTSC". This task is configured in tasks.json as shown below. But i keep getting error: "The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program...."

{
        "label":"RunTSC",
        "type": "npm",
        "script": "tsc",
        "path": "src/",
        "env":{},
        "problemMatcher": [],
  }

Very obvious, npm is not recognized. I admit that my OS's env variables do not have the PATH set to the location of npm. But i did set the "env" setting of the launch configuration to point to the npm location.

Can i say that the "env" only applies the launch configuration, and not the task that it prelaunch? If yes, then how do I specify the location of the npm in the visual studio code. In other word, is there a way to specify any environment variable globally via visual studio code, instead of via windows.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions