Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build NodeJS projects on Linux with the dotnet sdk #2335

Open
jeroenlandheer opened this issue May 24, 2021 · 2 comments
Open

Can't build NodeJS projects on Linux with the dotnet sdk #2335

jeroenlandheer opened this issue May 24, 2021 · 2 comments

Comments

@jeroenlandheer
Copy link

jeroenlandheer commented May 24, 2021

Expected Behavior

A working build.

Actual Behavior

When you build a solution on a linux machine, you'll get:

/*********.njsproj(98,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/3.1.409/Microsoft/VisualStudio/v16.0/Node.js Tools/Microsoft.NodejsToolsV2.targets" was not found. Confirm that the expression in the Import declaration "/usr/share/dotnet/sdk/3.1.409/Microsoft/VisualStudio/v16.0/Node.js Tools/Microsoft.NodejsToolsV2.targets" is correct, and that the file exists on disk.

So the .Net Core SDK doesn't contain the target files for NodeJS. I haven't seen any tools for installing these files on a Linux build server.

  • NTVS Version: 1.5.21130.2
  • Visual Studio Version: 16.9.6
  • Node.js Version: 16.2.0
@RobertPepkaSEL
Copy link

This is still a problem, and it happens in windows too. Steps to reproduce:

Observed Behavior

  • Install the latest 5.0.9 .net SDK.
  • Install Node 14 LTS.
  • Install a fresh copy of Visual Stu
  • Open Visual Studio 2019 community edition.
  • Create a new visual studio solution, with a Blank Node.js console application, named NodejsConsoleApp1.
  • Open a console and navigate to the root folder of NodejsConsoleApp1.
  • Type 'dotnet build'.

Result was:

C:\Users\me\source\repos\NodejsConsoleApp1> dotnet build
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj : warning NU1503: Skipping restore for project 'C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj'. The project file may be invalid or missing targets required for restore. [C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1.sln]
  Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.400\NuGet.targets(131,5): warning : Unable to find a project to restore! [C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1.sln]
C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj(35,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\5.0.400\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.400\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets" is correct, and that the file exists on disk.

Build FAILED.

C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj : warning NU1503: Skipping restore for project 'C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj'. The project file may be invalid or missing targets required for restore. [C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1.sln]
C:\Program Files\dotnet\sdk\5.0.400\NuGet.targets(131,5): warning : Unable to find a project to restore! [C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1.sln]
C:\Users\me\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\NodejsConsoleApp1.njsproj(35,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\5.0.400\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.400\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets" is correct, and that the file exists on disk.
    2 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.24
C:\Users\me\source\repos\NodejsConsoleApp1>

Desired Behavior

This is in contrast to doing this within visual studio, building the app (ctrl+shift+b or right click->build) allow the application to build without error:

Build started...
------ Build started: Project: NodejsConsoleApp1, Configuration: Debug Any CPU ------
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

@JessicaMulein
Copy link

having a similar issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants