Skip to content

Error after installing TS 1.8 beta through Nuget #6929

Closed
@smithkl42

Description

@smithkl42

I have a largish solution that was working correctly with TS 1.7. I installed the beta of TS 1.8 through the nuget packages (https://www.nuget.org/packages/Microsoft.TypeScript.Compiler/1.8.0-beta and https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild/1.8.0-beta). After installing these, when I build my solution, I get this error:

Description: Build: File 'COMPUTE_PATHS_ONLY.ts' not found
Project: Swyfft.Web
File: VSTSC

No idea what's up. Any suggestions for troubleshooting?

Activity

mhegazy

mhegazy commented on Feb 5, 2016

@mhegazy
Contributor

do you still have imports to $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" somewhere in your project file?

if so, please see the steps in https://github.com/Microsoft/TypeScript/wiki/Configuring-MSBuild-projects-to-use-NuGet, the next release should take care of this for you automatically.

smithkl42

smithkl42 commented on Feb 5, 2016

@smithkl42
Author

Well, that got rid of that error - thanks! I'd googled, but hadn't initially spotted that link.

But after I got rid of that error, when I built my project, I got several hundred other build errors that didn't initially strike me as correct. I'll hold off on migrating to 1.8 for now, I think :-). (I'd wanted the string literal types, but I can make it work with hacking enums to do what I need.)

mhegazy

mhegazy commented on Feb 6, 2016

@mhegazy
Contributor

what errors are you seeing?

mhegazy

mhegazy commented on Feb 6, 2016

@mhegazy
Contributor

and what version are you upgrading from?

smithkl42

smithkl42 commented on Feb 6, 2016

@smithkl42
Author

I'm upgrading from 1.7.6. But after following the instructions in the link above, I'm still not able to use TS 1.8 features. For instance, this is from the sample code for string literal types (#5185):

type CardinalDirection = "North"
    | "East"
    | "South"
    | "West";

But when I put that into my project after upgrading, I get these error messages:

Error TS2362 The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 17 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 18 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 19 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 20 Active

When I last did it, I also managed to get a whole bunch of errors insisting that various items referenced in DefinitelyTyped files were undefined (e.g., ko.observable(), that sort of thing). But I'm not seeing that right now at least.

mhegazy

mhegazy commented on Feb 6, 2016

@mhegazy
Contributor

But when I put that into my project after upgrading, I get these error messages:

the errors are about comparison locations, can you post a sample of the comparison you are doing. the error does not tell me what you were trying to do.

When I last did it, I also managed to get a whole bunch of errors insisting that various items referenced in DefinitelyTyped files were undefined (e.g., ko.observable(), that sort of thing). But I'm not seeing that right now at least.

what do you mean by "undefined"? at runtime? or were there a compiler crash?

smithkl42

smithkl42 commented on Feb 7, 2016

@smithkl42
Author

Sorry, what I meant is that after I upgraded, when I created a simple file that looks like this:

type CardinalDirection = "North"
    | "East"
    | "South"
    | "West";

The compiler threw the errors above. In other words, I don't think it was actually using the TS 1.8 compiler: my guess is that Visual Studio is still using the 1.7 compiler (which shows exactly the same error messages for that code).

With respect to the other errors, I think the actual error was "Cannot resolve symbol". In other words, in a line like:

var x = ko.observable('');

Where ko was defined in (say) knockout.d.ts, it would highlight ko and give the error "Cannot resolve symbol 'ko'". But like I said, the last time I tried it, I couldn't get it to repro that specific error.

mhegazy

mhegazy commented on Feb 7, 2016

@mhegazy
Contributor

Are the errors in VS? or when you build?

if it is from the build, can you look at the build log (tools\options\Projects and Solutions\Build and Run\MSBuild project build output verbosity, and chose Detailed), and see where tsc.exe is called from?

if it is from VS, did you install TS 1.8 VS plugin?

smithkl42

smithkl42 commented on Feb 8, 2016

@smithkl42
Author

The errors are showing up both in VS (i.e., with the little red squigglies on my code) and when I build.

It looks like it's using the 1.7.6 version of the compiler:

Using "VsTsc" task from assembly "C:\source\swyfft\swyf-website\packages\Microsoft.TypeScript.MSBuild.1.8.0-beta\tools\TypeScript.tasks.dll".
Task "VsTsc"
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\tsc.exe --sourcemap --target ES5 --noEmitOnError --locale en-US (....)
Done executing task "VsTsc".

And no, I didn't install the TS 1.8 VS plugin - my assumption (perhaps flawed) was that the point of the nuget package was so VS would use the nuget package over what was installed on my machine. So I've still got the 1.7.6 plugin installed.

This does raise a question that had me confused, namely, what the point of having two different nuget packages was. The instructions you pointed to earlier ( https://github.com/Microsoft/TypeScript/wiki/Configuring-MSBuild-projects-to-use-NuGet) only talk about installing the Microsoft.TypeScript.MsBuild task. I did that, but also installed the Microsoft.TypeScript.Compiler task - wasn't sure if that was correct or not, but it seemed appropriate. But perhaps I'm misunderstanding something.

mhegazy

mhegazy commented on Feb 8, 2016

@mhegazy
Contributor

you only need the MSBuild one. it subsumed the Complier package.

i think what you are running into is #6715. try upgrading to the nightly Nuget packge on Myget and the errors should go away.

locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdNeeds More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @smithkl42@mhegazy

        Issue actions

          Error after installing TS 1.8 beta through Nuget · Issue #6929 · microsoft/TypeScript