Skip to content
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

Compiling error trying to follow the "Orchard-Training-Demo-Module" (OSOE-778) #126

Closed
MarGraz opened this issue Jan 24, 2024 · 12 comments
Closed

Comments

@MarGraz
Copy link
Contributor

MarGraz commented Jan 24, 2024

Hi Everyone,

I'm new to Orchard Core, and after watching the Dojo Course 3 on YouTube, I started exploring the code, trying to set up this solution.

Here's what I did:

  1. Followed the first point of the "Orchard-Training-Demo-Module";
    1.1 Completed the prerequisites in this way:
    1.1.1 Followed these instructions to install Node.js on Windows using the installer and following the "Additional Configuration" specified here (like enabling long paths, etc.);
    1.1.2 Went back to the prerequisites and installed "PowerShell 7".
    1.1.3 Since I used a GUI to clone the repo, I didn't initialize the submodules, because the folder was already there (after cloning the branch);
  2. Returned to the "Orchard-Training-Demo-Module" readme, and cloned the repo Open-Source-Orchard-Core-Extensions;
  3. Set the starting project to: Lombiq.OSOCE.Web;
  4. Started the project;
  5. Encountered 42 Errors. You can find them in the attached file OrchardCore-LearningPath_Error-list.txt. The main error seems to be caused by the command "pnpm install" exiting with code 9009.

Can anyone help me?

Also, I'd like to provide feedback as suggested in Dojo Course 3. I feel that the process to install the "Orchard-Training-Demo-Module" that is "Open-Source-Orchard-Core-Extensions" locally, is too fragmented. As a new Orchard Core user, I found it confusing to jump around various readmes and follow parts of guides on different topics. A single, comprehensive guide in one place would be much more helpful for following the steps systematically.

Thank you

My dev environment:

  • Windows 11 Pro;
  • Visual Studio 2022 v. 17.8.5;
  • .NET 5, 6, 7 runtime installed;
  • NodeJs v. 20.11.0 x64

Jira issue

@github-actions github-actions bot changed the title Compiling error trying to follow the "Orchard-Training-Demo-Module" Compiling error trying to follow the "Orchard-Training-Demo-Module" (OSOE-778) Jan 24, 2024
@Piedone
Copy link
Member

Piedone commented Jan 24, 2024

I'm sorry to hear that, thanks for the detailed bug report though. Please share the build output (under the Output window in VS), since that'll provide details, the Error List only shows the end result.

Thanks for the suggestion! Primarily due to how Node build pipelines work, we'll need that kind of documentation. If we were to merge it into one, then we'd need to either maintain the same docs in multiple places, or have the same amount of links, just in different directions. We'll see if we can simplify this, but what we have as of now is what seems to be the minimum already.

@MarGraz MarGraz closed this as completed Jan 24, 2024
@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 24, 2024

@Piedone thank you for your reply.

I can imagine it's not easy to maintain the documentation in a single file. It's better to follow the principle of single responsibility here too 😊. Yes, perhaps simplifying it or adding a video that describes how to install the "Open-Source-Orchard-Core-Extensions" in a clean environment could be sufficient.

Here you can find my VS output: OrchardCore-LearningPath_Output-results.txt.

Thank you

@MarGraz MarGraz reopened this Jan 24, 2024
@Piedone
Copy link
Member

Piedone commented Jan 24, 2024

This is the error at the bottom of the whole thing:

11>"pnpm" non è riconosciuto come comando interno o esterno,
11> un programma eseguibile o un file batch.

I.e,, with DeepL:

11>"pnpm" is not recognized as an internal or external command,
11> an executable program or batch file.

I was running Node v18.13.0 but switched to v20.11.0 for testing this and it still works. So, that's not the issue.

It seems that VS can't find find Node on your machine, see https://stackoverflow.com/questions/49729401/release-of-asp-net-core-app-the-command-npm-install-exited-with-code-9009. Perhaps this can help.

Did you also do this?

Did you set up Node with NVM?

@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 25, 2024

@Piedone thank you for your reply.

Yes, I also followed the instructions in this guide. I followed the initial steps and then, as suggested, proceeded directly to the "Additional Configuration" section. I also restarted my PC.

I installed Node via it's installer, the x64 .msi as suggested in the "Recommended setup".

Now, I'll start looking for a solution, beginning with the link you provided.

Here are a few screenshots:

I enabled long paths by running "regedit" as an admin, because I'm a standard user on my PC:

long_path-enabled

I added NodeJs as external tools. On my PC, the path name for NodeJs is in lowercase. However, I've noticed there's no difference when it's written in Pascal Case:

VS_external_tools

Here's my "nodejs" folder (in lowercase):

NodeJs_path

I successfully installed the Visual Studio NPM Task Runner extension:

NPM_Task_Runner-Installed

@MarGraz MarGraz closed this as completed Jan 25, 2024
@MarGraz MarGraz reopened this Jan 25, 2024
@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 25, 2024

I have fixed the "pnpm" error, but now I have a new error that I will describe here.

To fix the "pnpm" error, I first checked via VS "Package Manager Console" if the pnpm was installed. I ran the command pnpm --version and got an error:

PM> pnpm --version
pnpm : The term 'pnpm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pnpm --version
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (pnpm:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

So, I first cheked if "npm" was available as command, to be sure that the NodeJs path we set in the "External Web Tools" was working, and it was:

PM> npm --version
10.2.4

I installed pnpm with the command npm install -g pnpm:

PM> npm install -g pnpm

added 1 package in 2s

1 package is looking for funding
  run `npm fund` for details`

and then I checked the version to be sure that it was installed:

PM> pnpm --version
8.14.3

I opened the Orchard solution and cleaned it, and rebuilt it. After 1 minute, VS displayed an error on top of the window, but the compiler was running, so I was happy 😁.
Here the VS error in text:

The project 'Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis' ran into a problem during the last operation: Cannot expand metadata in expression "$([MSBuild]::ValueOrDefault('%(FullPath)', '').StartsWith($([MSBuild]::EnsureTrailingSlash($(MSBuildProjectDirectory)))))". The item metadata "%(FullPath)" cannot be applied to the path "node_modules\nodejs-extensions\node_modules\%40textlint-rule\textlint-rule-no-invalid-control-character\lib\CONTROL_CHARACTERS.js". Path: C:\VS_Project\Internal_Project\OrchardCore-LearningPath\src\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis\node_modules\nodejs-extensions\node_modules\@textlint-rule\textlint-rule-no-invalid-control-character\lib\CONTROL_CHARACTERS.js exceeds the OS max path limit. The fully qualified file name must be less than 260 characters. C:\Program Files\dotnet\sdk\8.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets You may need to reload the solution after fixing the problem.

The same error in VS:

VS-Error

After a while, it finished to compiling, but with errors 😟. I checked the output panel (here is the entire output file "OrchardCore-Roslyn_error.txt") and the first FAIL was here:

61>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets(191,5): error : Could not find a part of the path 'C:\VS_Project\Internal_Project\OrchardCore-LearningPath\src\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis\obj\Debug\netstandard2.0\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis.GeneratedMSBuildEditorConfig.editorconfig'. 61>Done building project "Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis.csproj" -- FAILED.

So I cheked if this path exists C:\VS_Project\Internal_Project\OrchardCore-LearningPath\src\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis\obj\Debug\netstandard2.0\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis.GeneratedMSBuildEditorConfig.editorconfig, and it exists 🤔

I will investigate more to understand why. Maybe is something related to the error that VS showed me (this is strange: "The fully qualified file name must be less than 260 characters", is it something related to "regedit" and admin permission? 🤔), or maybe is because this file was compiled yesterday? Maybe is better if I delete the entire "Debug" folder to force a new compile.

The path [...]\Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis.GeneratedMSBuildEditorConfig.editorconfig exists but the file was created yesterday:

Path-Error

@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 25, 2024

I deleted all the obj and bin folders in the NodeJs.Extensions folder to force a new compile.

Now, I have 2 rebuilds failing (previously it was 3) and 87 succeeding, which is the same as before. There are additional failures (related to NodeJs clean process), but Visual Studio isn't displaying any errors. Here's the output file: OrchardCore-Errors_after_deleting_bin_obj_in_NodeJsExtensions.txt (search for "FAILED" and "failed").

Here an image showing the folders under NodeJs.Extensions:

NodeJs_Extensions-Folder

@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 25, 2024

I tried starting the web project and could see the "Setup" page. But when I click "Finish Setup", nothing happens.
The errors are always the same: 2 projects fail.

I even tried cloning the branch again, in a new folder, but I got the same result 😟.

NOTE that compiling the code in the new folder, I got 3 projects fail and again the error about 260 characters 🤔: [...] CONTROL_CHARACTERS.js exceeds the OS max path limit. The fully qualified file name must be less than 260 characters.

Here the results from the output panel of the "new folder" OrchardCore-New-Folder_Output.txt, and the errors panel OrchardCore-New-Folder_Errors.txt.

The "Setup" page:

setup_screen

@Piedone
Copy link
Member

Piedone commented Jan 25, 2024

To be clear, the configuration we recommend, and what's written in the docs as well, is NVM, not direct installation. NVM makes sure that your Node is usable in all ways, which may not necessarily be the case otherwise. So I recommend doing that, because anything else can be a can of worms.

You shouldn't have to install PNPM manually, that's enabled by Node.js Extensions automatically.

Do you run VS as admin? If not, that might cause part of this issue too.

The 260 character limit is a Windows limitations that's supposed to be fixed by enabling long paths, which you said you did. The "... exceeds the OS max path limit. The fully qualified file name must be less than 260 characters." is quite a clear indication of this being an issue. Unfortunately, I can't really help any more with that than what this documentation page says. I suggest you check whether otherwise paths longer than 260 characters work for you under Windows; if not, then there's a wider issue here.

@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 25, 2024

@Piedone thank you for your suggestions.

  • For the NVM part, in the doc I understood that if "I'm not part of Lombiq", I can skip the usage of NVM and install Node.js via its installer (you can find this part in the Recommended setup). This is why I installed Node.js via its installer. The next step was to follow the "Additional Configuration" instructions in the same page.

  • Ok for the PNPM. I will uninstall PNPM as well as Node.js (I will use NVM instead).

  • I always run VS 2022 as standard user. I tried also running it as an Admin, but I got the same errors.

  • It seems that in Windows 11 there are some issue with "long paths". See here.
    Are you using Windows 11?

I will try to go forward, and I will keep this issue updated.

@Piedone
Copy link
Member

Piedone commented Jan 25, 2024

I'll clarify the docs, thanks.

Yes, I use Windows 11.

@MarGraz
Copy link
Contributor Author

MarGraz commented Jan 26, 2024

Finally, I was able to run the Open-Source-Orchard-Core-Extensions 🥳

I installed Node.js using NVM and set up the "long paths" as explained in the Additional Configuration. However, it was necessary to reboot the computer for the changes to take effect.

What I noticed is that the first run of Lombiq.OSOCE.Web must be done using Ctrl + F5, rather than running the IIS Express (play button) in Visual Studio. If I use the IIS Express on the first run, I encounter more than 40 errors. However, after the initial setup of the project, it is possible to run it using the IIS play button.

I will suggest some improvements to the README with a pull request where I noticed unclear steps.

Thank you, @Piedone, for your support!

@MarGraz MarGraz closed this as completed Jan 26, 2024
@Piedone
Copy link
Member

Piedone commented Jan 26, 2024

Great then! Thank you, I'll review your PRs.

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

No branches or pull requests

2 participants