Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

[macOS] Yarn executable missing executable bit #19

Closed
jwosty opened this issue Jun 15, 2019 · 10 comments · Fixed by #25
Closed

[macOS] Yarn executable missing executable bit #19

jwosty opened this issue Jun 15, 2019 · 10 comments · Fixed by #25

Comments

@jwosty
Copy link

jwosty commented Jun 15, 2019

Build gives an error:

/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(5,5): Error MSB6003: The specified task executable "yarn" could not be run. ApplicationName='/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/dist/bin/yarn', CommandLine=' build', CurrentDirectory='/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS', Native error= Access denied (MSB6003) (StageForge.MacOS)

performing ls -l packages/Yarn.MSBuild/dist/bin/yarn shows the permissions -rw-r-r--r--; in other words, not executable. Workaround is to run chmod +x packages/Yarn.MSBuild/dist/bin/yarn, which fixes the problem temporarily.

I believe a solution is to make sure that the nuget package is built on a unix system, so that the executable bit can survive. If I can be of any help, let me know.

@jwosty
Copy link
Author

jwosty commented Jun 15, 2019

On second investigation, and alternate solution/workaround: run it with sh packages/Yarn.MSBuild/dist/bin/yarn, and it works without an executable bit.

@natemcmaster
Copy link
Owner

Interesting, I haven't seen this before and I'm using the package in macOS and Linux. Can you share more details? Which version of the package are you using? Are you building with VS for Mac, msbuild, dotnet, or all of them?

@jwosty
Copy link
Author

jwosty commented Jun 27, 2019

I'm using VSfM. It is an F# Xamarin.Mac project that has the Yarn target, which causes a build and bundling of an F# fable .NET Core 2.2 project.

Interestingly enough I've updated my IDE (to the latest -- version 8.1.1 build 72), and can no longer reproduce the problem. I had never tried building with the command line via msbuild, but I can confirm that this now works without my workaround. I wish I had recorded which version of VSfM I was using when it wasn't working... Sorry about that. I hope nobody else runs into this!

@jwosty jwosty closed this as completed Jun 27, 2019
@jwosty jwosty reopened this Jun 27, 2019
@jwosty
Copy link
Author

jwosty commented Jun 27, 2019

Nevermind, I lied; I forgot to add the yarn reference back after temporarily removing it.

Yarn.MSBuild resolved version is 1.15.2 .

$ mono --version
Mono JIT compiler version 5.18.1.28 (2018-08/223ea7ef92e Tue May 21 12:03:39 EDT 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(600)
	Suspend:       preemptive
	GC:            sgen (concurrent by default)

Here's a log from running msbuild:

Microsoft (R) Build Engine version 16.0.459+g5b35a69a2e for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 6/26/2019 11:01:21 PM.
Project "/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj" on node 1 (default targets).
YarnBuild:
  /Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/dist/bin/yarn run webpack 
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003: The specified task executable "yarn" could not be run. System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/dist/bin/yarn', CommandLine=' run webpack', CurrentDirectory='/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS', Native error= Access denied [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in <118907f5eb5f4e538f3e3bdd8361378f>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at System.Diagnostics.Process.Start () [0x0003a] in <118907f5eb5f4e538f3e3bdd8361378f>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start() [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at Microsoft.Build.Utilities.ToolTask.ExecuteTool (System.String pathToTool, System.String responseFileCommands, System.String commandLineCommands) [0x000c9] in <e7918b655c524bee905d411ec2ed37a6>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at Microsoft.Build.Utilities.ToolTask.Execute () [0x003a8] in <e7918b655c524bee905d411ec2ed37a6>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
Done Building Project "/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj" (default targets) -- FAILED.

Build FAILED.

"/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj" (default target) (1) ->
(YarnBuild target) -> 
  /Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003: The specified task executable "yarn" could not be run. System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/dist/bin/yarn', CommandLine=' run webpack', CurrentDirectory='/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS', Native error= Access denied [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in <118907f5eb5f4e538f3e3bdd8361378f>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at System.Diagnostics.Process.Start () [0x0003a] in <118907f5eb5f4e538f3e3bdd8361378f>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start() [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at Microsoft.Build.Utilities.ToolTask.ExecuteTool (System.String pathToTool, System.String responseFileCommands, System.String commandLineCommands) [0x000c9] in <e7918b655c524bee905d411ec2ed37a6>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]
/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(10,5): error MSB6003:   at Microsoft.Build.Utilities.ToolTask.Execute () [0x003a8] in <e7918b655c524bee905d411ec2ed37a6>:0  [/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS/StageForge.MacOS.fsproj]

    0 Warning(s)
    1 Error(s)

I'm referencing it in my Xamarin.Mac project like so:

...
  <PropertyGroup>
    <YarnBuildCommand>build</YarnBuildCommand>
  </PropertyGroup>
...

@natemcmaster
Copy link
Owner

It seems like this is a quirk of MSBuild for mono. MSBuild for dotnet works fine.

.nupkg files are actually just ZIP, which does not support Linux permissions, so to fix this we need to either chmod yarn before running it or use sh.

I'm on vacation for 2 weeks and don't have a laptop, but I would take a PR to fix this if you want a fix sooner.

@natemcmaster
Copy link
Owner

I looked into this a little more, and haven't been able to reproduce the problem using the version of mono you listed (5.18.1). I'm not sure what I can do to fix this.

It appears the executable bit is set by NuGet when it is extracting the package (NuGet/NuGet.Client#1346). If you are not seeing this happen, you might be using an older version of NuGet which doesn't do this correctly (see NuGet/Home#4424). Try updating all of your .NET Core/VS/Rider installations to use the latest NuGet version.

@no-response
Copy link

no-response bot commented Jul 29, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. Thank you for your contributions to this project.

@no-response no-response bot closed this as completed Jul 29, 2019
@jwosty
Copy link
Author

jwosty commented Jan 10, 2020

Hmm I've run into this again while creating a sample application for my library. Here's a repo: https://github.com/jwosty/InterstellarFableHelloWorld/tree/2eed9ed17192abdb79a593b0559941b23057a6ce

Are you able to build this thing in VS for Mac? I can't. :/

@no-response no-response bot reopened this Jan 10, 2020
@jwosty
Copy link
Author

jwosty commented Jan 10, 2020

VS for Mac indicates it's using mono 6.4.0.208 (though mono 5.18.1.28 is also listed as being installed). msbuild -version gives 16.3.0.47501. nuget says its 5.2.0.6090.

It also fails for the same reason when building with msbuild on the command line.

@natemcmaster
Copy link
Owner

Don't know what is wrong with VS for Mac, but here's a simple fix: #25

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

Successfully merging a pull request may close this issue.

2 participants