LoadError: expected package to have a `name`-entry?

I want to make an executable file. When I start the compilation, I get the below error:

┌ Warning: it is not recommended to create an app/library without a preexisting manifest
└ @ PackageCompiler C:\Users\amroa\.julia\packages\PackageCompiler\vXKVp\src\PackageCompiler.jl:66
ERROR: LoadError: expected package to have a `name`-entry

Where is my problem?

It seems like Project.toml wasn’t generated correctly, or got erased. Maybe something you did later accidentally erased it?

Why is generate commented out?

Try again in a blank directory.

btw, @__DIR__ is itself a string, so I don’t think you need to interpolate it into a string with $.

Thanks for the tip.
I used a full directory rather than @__DIR__ , however, the same error

You need a directory that doesn’t already have a Project.toml file in it for generate to work.

Great, progress! It sounds like folderpackage itself has an issue.

I think it’s this syntax error: end myfunction; did you mean to have that as a comment like end #myfunction ?

I figured that out by directly pasting your code from folderpackage.jl into the REPL, which revealed the site of the error.

If a package fails to precompile, it means there’s an error somewhere in those code files, so you have to dissect it from there.

Yes, I have something like end #myfunction which I kept is as just end

Type ] to use the Pkg REPL, make sure to activate . to activate the folderpackage package, then for each package you want to add as a dependency, use add PackageName

The name in the parentheses should be the package you want to work with. activate . uses the current directory, so you would need to activate folderpackage instead, but then yes do what you showed.

Though you don’t need to add Base.

Notice the path of the Project.toml file being worked with; you accidentally created a subfolder.

No, you should not have a folder of the same name as the parent folder. There was likely a confusion; activate . should have been sufficient, but what you typed above suggested to me it was not. That led me to suggest activate folderpackage instead, which created a subfolder.

That one is unfortunately beyond me and you should probably make a new post specifically about PackageCompiler.

It shouldn’t say (Myfolder) when you want to add packages to folderpackage though.

1 Like

Perhaps the issue is that you ran activate folderpackage when it already said (folderpackage) pkg>. Make sure you only do it the one time when it says (Myfolder) pkg>.

1 Like

Yes, you’ll have to make a new post for that error.

1 Like

Ok, thank you very much for you all responses which were so helpful for me

1 Like

You’re welcome!

1 Like