I have a build process in Azure DevOps for a web application that includes TypeScript files. I am stuck on this error:
ERROR: Failed to find ‘typescript’ module. Please check, NODE_PATH contains location of global ‘typescript’ or install locally in your project
What I have tried:
- installed TypeScript SDK on my build agent.
- ran npm install -g TypeScript on the build agent.
- ran on the agent: SET NODE_PATH=%AppData%\npm\node_modules
- added Microsoft.TypeScript.Compiler nuget package to the project.
- added “npm install” step to the build process just before the Run Code Analysis step. (I didn’t set the working directory for the package.json since I wasn’t sure where the relevant directory would be that contains the packages that sonarsource needs.)
Could someone please explain what either of the suggested options from the error message mean?
“NODE_PATH contains location of global ‘typescript’” - Is this the TypeScript compiler program? What executable is this looking for? Assuming NODE_PATH is an environment variable.
“install locally in your project” - install what to where? Does “project” mean “source code”? Add a reference via NuGet?