Skip to content

source-building .NET 7 fails if nodejs is installed on the machine #42378

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

Closed
omajid opened this issue Jun 22, 2022 · 9 comments
Closed

source-building .NET 7 fails if nodejs is installed on the machine #42378

omajid opened this issue Jun 22, 2022 · 9 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity

Comments

@omajid
Copy link
Member

omajid commented Jun 22, 2022

Describe the Bug

I am trying to build .NET 7 (source-build) from the installer's main branch.

The build fails if nodejs is installed on my machine.

...
      $ node ../common/node_modules/webpack-cli/bin/cli.js

      Duplicate Sources / Packages - No duplicates found. 🚀

      asset signalr-protocol-msgpack.js 79.5 KiB [emitted] (name: signalr-protocol-msgpack) 1 related asset
      asset signalr-protocol-msgpack.min.js 28.1 KiB [emitted] [minimized] (name: signalr-protocol-msgpack.min) 1 related asset
      orphan modules 87.3 KiB [orphan] 20 modules
      runtime modules 1.31 KiB 6 modules
      built modules 75.9 KiB [built]
        ./src/browser-index.ts + 15 modules 75.8 KiB [built] [code generated]
          ModuleConcatenation bailout: Cannot concat with external "signalR": umd externals can't be concatenated
        external "signalR" 42 bytes [built] [code generated]
          ModuleConcatenation bailout: umd externals can't be concatenated
      webpack 5.72.1 compiled successfully in 2625 ms
      $ node ../common/node_modules/terser/bin/terser -m -c --ecma 2019 --module --source-map "url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js
      Done in 11.44s.
      yarn version v1.22.10
      info Current version: 5.0.0-dev
      error Invalid version supplied.
      info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr-protocol-msgpack/signalr-protocol-msgpack.npmproj]
    ##vso[task.logissue type=error;sourcepath=dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=105;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.
      yarn version v1.22.10
      info Current version: 5.0.0-dev
      error Invalid version supplied.
      info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr/signalr.npmproj]
    ##vso[task.logissue type=error;sourcepath=dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=105;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.
      yarn version v1.22.10
      info Current version: 7.0.0-dev
      error Invalid version supplied.
      info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/JSInterop/Microsoft.JSInterop.JS/src/Microsoft.JSInterop.JS.npmproj]                                                                                                                                                                            ##vso[task.logissue type=error;sourcepath=dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=105;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.

    Build FAILED.

    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr-protocol-msgpack/signalr-protocol-msgpack.npmproj]
    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr/signalr.npmproj]
    dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(105,5): error MSB6006: "yarn" exited with code 1. [dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/JSInterop/Microsoft.JSInterop.JS/src/Microsoft.JSInterop.JS.npmproj]
        0 Warning(s)
        3 Error(s)

It looks like there's some javascript code that deals with versions, and it sees a 7.0.0-dev version string and simply fails.

The build works fine if I uninstall nodejs.

I could not reproduce this error just building aspnetcore repo by itself.

Steps to Reproduce

Install nodejs, build .NET installer (source-build)

Inside a failing build, I can reproduce using:

$ cd /dotnet7.0/dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr
$ /dotnet7.0//dotnet-main-x64-bootstrap/src/aspnetcore/artifacts/source-build/self/package-cache/yarn.msbuild/1.22.10/dist/bin/yarn version --no-git-tag-version --new-version
yarn version v1.22.10
info Current version: 5.0.0-dev
error Invalid version supplied.
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
$ grep version package.json 
  "version": "5.0.0-dev",
    "prepack": "node ../build/embed-version.js",

Other Information

@MichaelSimons MichaelSimons transferred this issue from dotnet/source-build Jun 23, 2022
@adityamandaleeka adityamandaleeka added area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework and removed untriaged area-build labels Jun 25, 2022
@adityamandaleeka
Copy link
Member

@dotnet/aspnet-build can you please help triage/route this?

@dougbu
Copy link
Contributor

dougbu commented Jun 25, 2022

I'm not sure of the best way to handle this nor now widespread a problem it's likely to be. It seems like the main issue relates to our npm versions rather than the installed nodejs version but I'm not sure. @javiercn and @SteveSandersonMS may have useful opinions here.

@omajid what's happening here is Npm.Common.targets updates packages.json files to use versions aligned w/ the current build. This works for me locally but I have node installed locally at v16.15.0 and yarn at v1.22.19. The second one might be the problem for you.

Separately, if you uninstall nodejs, the build automatically disables *.npmproj builds. Npm.Common.targets doesn't hit any problems when it's not used😁

@dougbu
Copy link
Contributor

dougbu commented Jun 25, 2022

This works

I mean building 7.0.0-dev packages works. Something in yarn (older Yarn) or its supporting packages might be fine w/ e.g. 7.0.0-preview.5.22303.8 packages but not that.

@omajid
Copy link
Member Author

omajid commented Jun 29, 2022

The thing that confuses me is that on the same machine, I can't build aspnetcore via source-build but I can build it standalone. The nodejs version on my machine is the same for both builds.

@wtgodbe
Copy link
Member

wtgodbe commented Jul 18, 2022

@SteveSandersonMS @javiercn do you know anything about why this may be happening?

@javiercn
Copy link
Member

@wtgodbe very likely node is installed on the machine but yarn is not.

npm install --global [email protected] should do the trick.

@wtgodbe
Copy link
Member

wtgodbe commented Aug 4, 2022

@omajid did Javier's suggestion fix your issue?

@wtgodbe wtgodbe added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Aug 4, 2022
@ghost
Copy link

ghost commented Aug 4, 2022

Hi @omajid. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ghost
Copy link

ghost commented Aug 9, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Aug 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

5 participants