fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 524 forks source link

Paket can't run npm script as build command on Windows (Git Bash) #3860

Open TicoDePano opened 4 years ago

TicoDePano commented 4 years ago

Description

I have a git dependency in paket.dependencies that has build: "npm run pack nupkg", packages: nupkg.

npm run pack, for brevity, is configured to restore npm, paket, build project and run paket pack with the argument as path folder (nupkg in my case).

On Linux it works, on Windows (Git Bash), it fails and I can't get what to do to workaround it.

Repro steps

My projects are netcoreapp3.1, B referencing A.

paket.dependencies in B:

git git.mappa.info:Mappa/Mappa.Extensions.Web master build: "npm run pack nupkg", packages: nupkg nuget Mappa.Extensions.Web

scritp available in package.json in A:

"pack": "npm i && npm run restore && npm run build -- -c Release && npm run paket -- pack --lock-dependencies"

Expected behavior

Like in Linux:

Paket version 5.245.2 Starting full restore process. Checking for uncommitted changes in /home/josevero/Git/Mappa/paket-files/git.mappa.info/Mappa/Mappa.Extensions.Web Checking for commits made in detached HEAD state in /home/josevero/Git/Mappa/paket-files/git.mappa.info/Mappa/Mappa.Extensions.Web Setting /home/josevero/Git/Mappa/paket-files/git.mappa.info/Mappa/Mappa.Extensions.Web to 696f6b11a4adfdc458827a383d1b4385b2879138 Running "npm run pack nupkg" Performance:

  • Runtime: 12 seconds

Actual behavior

But in Windows:

Paket version 5.245.2 Starting full restore process. Checking for uncommitted changes in D:\Git\Mappa\paket-files\git.mappa.info\Mappa\Mappa.Extensions.Web Checking for commits made in detached HEAD state in D:\Git\Mappa\paket-files\git.mappa.info\Mappa\Mappa.Extensions.Web Setting D:\Git\Mappa\paket-files\git.mappa.info\Mappa\Mappa.Extensions.Web to 696f6b11a4adfdc458827a383d1b4385b2879138 Running "npm run pack nupkg" Performance:

  • Runtime: 2 seconds Paket failed with -> Could not run "npm run pack nupkg". Error: Start of process npm failed.

Known workarounds

I can't found any workaround.

TicoDePano commented 4 years ago

Running the script manually from D:\Git\Mappa\paket-files\git.mappa.info\Mappa\Mappa.Extensions.Web works on Windows too.

TicoDePano commented 4 years ago

Sorry, I did not see the verbose switch in restore:

Paket failed with -> Could not run "npm run pack nupkg". Error: Start of process npm failed. StackTrace: at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1645.Invoke(String message) at Paket.RemoteDownload.downloadRemoteFiles@220-8.Invoke(Exception _arg2) in D:\code\Paket\src\Paket.Core\Dependencies\RemoteDownload.fs:line 237 at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@522.Invoke(AsyncParams1 args) --- End of stack trace from previous location where exception was thrown --- at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult1 res) at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync1 computation) at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync1 computation, FSharpOption1 timeout) at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync1 computation, FSharpOption1 timeout, FSharpOption1 cancellationToken) at Paket.RemoteDownload.DownloadSourceFiles(String rootPath, GroupName groupName, Boolean force, FSharpList1 sourceFiles) in D:\code\Paket\src\Paket.Core\Dependencies\RemoteDownload.fs:line 339 at Paket.RestoreProcess.restore@139.Invoke(Unit unitVar) in D:\code\Paket\src\Paket.Core\Installation\RestoreProcess.fs:line 140 at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@522.Invoke(AsyncParams1 args) --- End of stack trace from previous location where exception was thrown --- at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult1 res) at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a](CancellationToken token, FSharpAsync1 computation) at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync1 computation, FSharpOption1 timeout) at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync1 computation, FSharpOption1 timeout, FSharpOption1 cancellationToken) at Paket.RestoreProcess.Restore@822-10.Invoke(Unit unitVar0) in D:\code\Paket\src\Paket.Core\Installation\RestoreProcess.fs:line 832 at Paket.Utils.RunInLockedAccessMode[a](String lockedFolder, FSharpFunc2 action) in D:\code\Paket\src\Paket.Core\Common\Utils.fs:line 515 at Paket.RestoreProcess.Restore(String dependenciesFileName, RestoreProjectOptions projectFile, Boolean force, FSharpOption1 group, Boolean ignoreChecks, Boolean failOnChecks, FSharpOption1 targetFrameworks, FSharpOption1 outputPath, Boolean skipRestoreTargets Extraction) in D:\code\Paket\src\Paket.Core\Installation\RestoreProcess.fs:line 820 at Paket.Program.handleCommand@842-14.Invoke(ParseResults1 results) in D:\code\Paket\src\Paket\Program.fs:line 842 at Paket.Program.processWithValidationEx$cont@42[a](Boolean silent, FSharpFunc2 commandF, a result, Unit unitVar) in D:\code\Paket\src\Paket\Program.fs:line 43 at Paket.Program.processWithValidationEx[a](FSharpFunc2 printUsage, Boolean silent, FSharpFunc2 validateF, FSharpFunc2 commandF, a result) in D:\code\Paket\src\Paket\Program.fs:line 35 at Paket.Program.handleCommand(Boolean silent, Command command) in D:\code\Paket\src\Paket\Program.fs:line 842 at Paket.Program.main() in D:\code\Paket\src\Paket\Program.fs:line 934