-1

I am new in haskell programming. For my university project our teacher send us the project and ask us to run these command : "stack init" then "stack build" when i am running stack build a got this error :

Project.cabal was modified manually. Ignoring Project\package.yaml in favor of the Cabal file.
If you want to use the package.yaml file instead of the Cabal file,
then please delete the Cabal file.
Executable named sh not found on path: ....."Path"

Can anyone help solve the problem please ?

remove all project and try again .

2
  • The error says Executable named sh not found on path have you tried checking if sh is in PATH? Commented Mar 29, 2023 at 14:56
  • Does the error actually say ....."Path", or have you deleted part of the error? If you have deleted part of the error, please undelete it. I understand that you are trying to be helpful, and appreciate it, but I think in this specific case the full contents is better. If there is sensitive information in the real error that you'd like to hide, perhaps you could randomize that section rather than omitting it. Commented Mar 29, 2023 at 15:36

2 Answers 2

1

Had the same issue with a fresh GHCup install on Windows 10.

    Executable named sh not found on path: ~entire windows path variable~

For some reason GHCup doesn't add msys to the path on install, which contains sh.exe.

Assuming default install options, add the following to the "Path" user environment variable through the windows dialogue:

    C:\ghcup\msys64\usr\bin

Solution found by reading about an old Stack bug here.

Sign up to request clarification or add additional context in comments.

Comments

0

In general, stack init is only run once to initialize a new project. You would typically run this in an empty directory, where it will create a stack.yaml from some template.

This template stack.yaml mostly contains comments that explain you all the different options.

However, you could also manually create it, like for instance:

resolver: lts-20.16

Once you have your stack.yaml in place, there are two options:

You can either use a traditional <your-project-name>.cabal file, or write a package.yaml file. See https://github.com/sol/hpack for details on how to write such a file.

When you use stack build, and there is only a .cabal file and no package.yaml, then Stack will use that.

However, if a package.yaml exists, then Stack will automatically create and update the <your-project-name>.cabal file for you.

And prior to doing so, it will check whether that file is newer than the stack.yaml or package.yaml, to avoid possibly overwriting any manual changes in that file.

So the error message that you're getting should normally mean that someboy (ie. your teacher) manually edited the Project.cabal file although a package.yaml exists.

However, what is puzzling about it is that normally, both files should be in the project's root directory - but your error message contains a Windows-style path-name in it.

Then, there is the ever more troubling last line - about sh not found on path.

Is it possible that you are trying to run this on Windows?

I have never used Haskell on Windows myself, so I have no clue about how that should work. But an error message about the Linux / Unix command interpreter sh not being found would be typical for some Linux / Unix software that's not been fully ported to Windows yet.

I am also solely basing my "Windows suspicion" on the first line of the error message, which contains a path with a backslash in it, as it would on Windows.

But maybe my general description of the Stack build process can help shed some light on this as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.