Error in TypeScript MSBuild: URI creation from *.js & .map.js has failed

I recently integrated the TypeScript.MSBuild NuGet package into two different projects.

(Just tested it with version 2.7.2.)

Locally, everything runs smoothly. On Kudu, the build process is successful as well. However, on travis-ci and Bitbucket's pipelines, I encounter the following error for each .ts file:

CompileTypeScriptWithTSConfig: 
    /home/travis/.nvm/versions/node/v6.12.0/bin/node /home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/tsc/tsc.js --project "/home/travis/build/<user>/<project>/Scripts/TypeScript/tsconfig.json" --listEmittedFiles

    /home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/Microsoft.TypeScript.targets(444,5): error : Failed to create URI from '\home\travis\build\<user>\<project>\Scripts\TypeScript\App.js'. [/home/travis/build/<user>/<project>/<project>.csproj]
    /home/travis/build/<user>/<project>/packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/Microsoft.TypeScript.targets(444,5): error : Failed to create URI from '\home\travis\build\<user>\<project>\Scripts\TypeScript\App.js.map'. [/home/travis/build/<user>/<project>/<project>.csproj]

The contents of my tsconfig.json file are as follows:

{
  "compilerOptions": {
    "noImplicitAny": true,
    "noImplicitThis": true,
    "noEmitOnError": true,
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true,
    "removeComments": true
  },
  "compileOnSave": true
}

Furthermore, running the command locally provides the expected results: (I even tried executing nvm use 6.12.0 to rule out any potential node issues)

C:\Users\User\Projects\Project> node ./packages/Microsoft.TypeScript.MSBuild.2.7.2/tools/tsc/tsc.js --project "<Project>/Scripts/TypeScript/tsconfig.json" --listEmittedFiles
TSFILE: C:/Users/User/Projects/Project/Scripts/TypeScript/App.js
TSFILE: C:/Users/User/Projects/Project/Scripts/TypeScript/App.js.map

Hence, my query is: How can I effectively utilize the TypeScript.MSBuild NuGet package in conjunction with my ci?

EDIT: Upon connecting to the travis container via ssh, I attempted the msbuild command twice. Surprisingly, it successfully compiled on the second attempt. It appears that the MSBuild task may be attempting to build a URI prematurely, perhaps?

Answer №1

After relocating tsconfig.json to the project's main directory, I was able to get it functioning properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using the keyof operator to determine the data type of a property within a TypeScript class

According to TypeScript's documentation on the keyof operator, you can access a property of an object instance using this function below. function getProperty<T, K extends keyof T>(o: T, name: K) { return o[name]; } If you want to obtain th ...

What steps should I take to resolve the eslint issue indicating that a TypeScript props interface is not being utilized, even though it is being used?

One of my components utilizes AvatarProps for its props: https://i.sstatic.net/cZBl1.png Below is the interface declaration for AvatarProps: export interface AvatarProps { userName: string; userLastName: string; userImg?: string; onPress?: Functi ...

Having trouble with importing rxjs operators

After updating the imports for rxjs operators in my project to follow the new recommended syntax, I encountered an issue with the "do" operator. While switchMap and debounceTime were updated successfully like this: import { switchMap, debounceTime } ...

After applying the map function in Typescript, the resulting values may vary in their

I work with three different interfaces interface A { productId: string; productName?: string; quantity: number; } interface B { productId: string; productName?: string; company: string; } interface Product { id: string; name: string; In ...

What is the best way to format a string into a specific pattern within an Angular application

In my Angular component, I have 4 fields: customerName, startDate, and startTime. Additionally, I have a fourth field that is a textarea where the user can see the message that will be sent via email or SMS. Within my component, I have defined a string as ...

Issue with React filter function where data is not being displayed when search query is left

I am facing an issue where the data does not show up when the search term is empty. Previously, I used to have this line in my code if (!searchTerm) return data for my old JSON data, and it worked fine. However, now that I'm using Sanity CDN, this lo ...

Developing a custom functionality to retrieve a server cookie for authentication in NextJS version 14

I am in the process of incorporating an email address verification feature for users registering on my NextJS website with a WordPress installation as a headless CMS. Here's what I plan to do: Set a server token with the following value {id: <use ...

Combining multiple data types in an AJV array

Imagine you have the following defined type: type MixedArray = Array<number | string>; Now, let's say you have some sample data that needs to be validated: [ 'dfdf', 9, 0, 'sdfdsf' ] How can you create an Ajv JSONSchemeType ...

Guide on Linking a Variable to $scope in Angular 2

Struggling to find up-to-date Angular 2 syntax is a challenge. So, how can we properly connect variables (whether simple or objects) in Angular now that the concept of controller $scope has evolved? import {Component} from '@angular/core' @Comp ...

Exploring Vue 3: Crafting a custom plugin using the composition API and enhancing it with Typescript type augmentation

Encountering an issue with displaying plugins properly within <script> and <template> tags on WebStorm. Firstly, let's take a look at my files and configuration: tsconfig.config.json { "extends": "@vue/tsconfig/tsconfig. ...

Gathering user key event input for a duration of 2 seconds before resetting it

I need help implementing a feature where I can clear the user's input text after 500ms if they are entering characters consecutively. private userInputTimer; private userInputText = ''; private handleEvent(event: KeyboardEvent): void { if ...

Group multiple typescript files into separate outFile modules

Can TypeScript files be grouped into multiple outFiles? I want to bundle my Typescript code, but instead of one single JS file, I would like to organize my TS into separate JS files such as controllers.js and plugins.js. The options in the TypeScript pro ...

The system encountered an issue while trying to access the property 'emailVerified' of an undefined object

I am currently working on retrieving the current user and attempting to assign the user values to a getter. In the constructor, I can see in the console that it is returning "email verified" as true. However, when trying to set it in the getter, I am enc ...

Encountering issues with accessing the clientWidth and clientHeight references of the DOM in Vue

Issue with 'clientWidth' and 'clientHeight' properties on Vue and Element types. <div class="invoice-step-detail" id="invoice" ref="invoice"> @Component({ name: 'CreateInvoice', co ...

Encountering the issue of receiving undefined values for both error and url during the utilization

I'm currently working on a file called createCheckoutSession.ts: import { db } from '../firebase/firebaseInit'; import { collection, addDoc, onSnapshot } from 'firebase/firestore'; import { User } from 'firebase/auth'; e ...

This property cannot be found on the specified type

So, I have this TypeScript function that will return one of two different objects based on the input value: function myfunc(isError:boolean): {response:string}|{error:string} { if(isError) return {error:''} return {response:''} } N ...

Having trouble typing computed values in Vue Composition API with TypeScript?

I'm attempting to obtain a computed value using the composition API in vue, and here is the code I am working with: setup() { const store = useStore(); const spaUrls = inject<SpaUrls>('spaUrls'); const azureAd = inject<AzureAd ...

Typescript: Deciphering how to interpret a string with a mix of characters and numbers

Is there a way in TypeScript to add 40 to a variable of type string | number, and return a result as a string | number? My initial approach was to parse the variable to a number, then perform the addition, but how can I ensure that the variable is proper ...

Navigating through an interface array using *ngFor in TypeScript

After successfully implementing an interface to retrieve data from a service class, I encountered an issue when attempting to iterate through the FilteredSubject interface array. Despite using console.log, I was unable to achieve the desired outcome. You ...

Angular2 - Issue with calling toPromise() method on this.http.get() function, as it is not recognized

I was following a tutorial on angular.io called Tour the Heroes, but instead of sticking to the tutorial I decided to make a real GET request for some JSON data. Here is a snippet of my code: private userUrl = 'https://jsonplaceholder.typicode.com ...