Issue with @types/socket.io with electronize build #244

Closed
opened 2026-01-29 16:34:36 +00:00 by claunia · 13 comments
Owner

Originally created by @hhfranzo on GitHub (Dec 20, 2018).

Originally assigned to: @robertmuehsig on GitHub.

Hi,

I'm experiencing an issue when I try to build the application with "electronize build /target win"
The build fails with the following message:

"Packaging app for platform win32 x64 using electron v3.0.0
Failed to locate module "@types/socket.io" from "."
This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed."

Did I miss to install some packages? Note that I already ran "npm install socket.io -g".

Thanks.

Originally created by @hhfranzo on GitHub (Dec 20, 2018). Originally assigned to: @robertmuehsig on GitHub. Hi, I'm experiencing an issue when I try to build the application with "electronize build /target win" The build fails with the following message: "Packaging app for platform win32 x64 using electron v3.0.0 Failed to locate module "@types/socket.io" from "." This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed." Did I miss to install some packages? Note that I already ran "npm install socket.io -g". Thanks.
Author
Owner

@hhfranzo commented on GitHub (Dec 20, 2018):

Forgot to say that I'm using Electron.NET 0.0.10...

@hhfranzo commented on GitHub (Dec 20, 2018): Forgot to say that I'm using Electron.NET 0.0.10...
Author
Owner

@JimmyTheJ commented on GitHub (Dec 20, 2018):

I have been working on this repo for the last couple days as I have had a similar problem since upgrading to Dotnet Core 2.2.

You can fork the repo and change the BuildCommand.cs file for the CLI to do npm install without the --production and that might fix it. I plan on putting in a pull request with some fixes since 0.0.10 release and Dotnet Core 2.2 broke some things at some point soon but not sure exactly when.

@JimmyTheJ commented on GitHub (Dec 20, 2018): I have been working on this repo for the last couple days as I have had a similar problem since upgrading to Dotnet Core 2.2. You can fork the repo and change the BuildCommand.cs file for the CLI to do npm install without the --production and that might fix it. I plan on putting in a pull request with some fixes since 0.0.10 release and Dotnet Core 2.2 broke some things at some point soon but not sure exactly when.
Author
Owner

@paillave commented on GitHub (Dec 23, 2018):

Here is what is get at the end of the command electronize build /target win

C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger>
Skip npm install, because node_modules directory exists in: C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win\node_modules
Build Electron Desktop Application...
Executing electron magic in this directory: C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\bin\desktop
Package Electron App for Platform win32...
Microsoft Windows [Version 10.0.17134.472]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win>electron-packager . --platform=win32 --arch=x64  --out="C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\bin\desktop" --overwrite
Packaging app for platform win32 x64 using electron v3.0.0
Failed to locate module "@types/socket.io" from "."
        This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager).  Or your module installation failed.
C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win>
... done

What is strange is that the electronize start command works with no problem.

@paillave commented on GitHub (Dec 23, 2018): Here is what is get at the end of the command `electronize build /target win` ``` C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger> Skip npm install, because node_modules directory exists in: C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win\node_modules Build Electron Desktop Application... Executing electron magic in this directory: C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\bin\desktop Package Electron App for Platform win32... Microsoft Windows [Version 10.0.17134.472] (c) 2018 Microsoft Corporation. All rights reserved. C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win>electron-packager . --platform=win32 --arch=x64 --out="C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\bin\desktop" --overwrite Packaging app for platform win32 x64 using electron v3.0.0 Failed to locate module "@types/socket.io" from "." This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed. C:\Users\paill\Documents\GitHub\Etl.Net\src\Paillave.Etl.Debugger\obj\desktop\win> ... done ``` What is strange is that the `electronize start` command works with no problem.
Author
Owner

@paillave commented on GitHub (Dec 25, 2018):

I found the reason of the bug (it actually seems to be a bug in ElectronNET).

On a fresh project (or at least, a where the folder obj/desktop/XXX doesn't exist already), the build with ElectronNET version 0.0.10 can't possibly work.

Here is the content of package.json that will be used to build electron host (the one in the folder obj\desktop\win): dc3eec37bb/ElectronNET.Host/package.json (L11-L21)

The problem is that the automatic batch executes an npm install --production like we can see in log and also in the source code of ElectronNET: dc3eec37bb/ElectronNET.CLI/Commands/BuildCommand.cs (L94)
The problem is that --production argument for npm install asks npm to ignore what is mentioned in the devDependencies node. That is why electron is lost when trying to make the final build of the application as socket.io types are missing for typescript compilation.

This --production argument has been add by @GregorBiswanger for a big refactoring in the commit 524e6c8.
I could push a fix, but I can imagine he had a good reason to add this problematic switch as he is involved in this project since the start. It's better he chooses the proper solution for this issue.

@paillave commented on GitHub (Dec 25, 2018): I found the reason of the bug (it actually seems to be a bug in ElectronNET). On a fresh project (or at least, a where the folder `obj/desktop/XXX` doesn't exist already), the build with ElectronNET version 0.0.10 can't possibly work. Here is the content of `package.json` that will be used to build electron host (the one in the folder `obj\desktop\win`): https://github.com/ElectronNET/Electron.NET/blob/dc3eec37bb1c6caf8c486f2dfeba1861f3d46835/ElectronNET.Host/package.json#L11-L21 The problem is that the automatic batch executes an `npm install --production` like we can see in log and also in the source code of ElectronNET: https://github.com/ElectronNET/Electron.NET/blob/dc3eec37bb1c6caf8c486f2dfeba1861f3d46835/ElectronNET.CLI/Commands/BuildCommand.cs#L94 The problem is that `--production` argument for `npm install` asks npm to ignore what is mentioned in the `devDependencies` node. That is why electron is lost when trying to make the final build of the application as `socket.io` types are missing for typescript compilation. This `--production` argument has been add by @GregorBiswanger for a big refactoring in the commit 524e6c8. I could push a fix, but I can imagine he had a good reason to add this problematic switch as he is involved in this project since the start. It's better he chooses the proper solution for this issue.
Author
Owner

@JimmyTheJ commented on GitHub (Dec 26, 2018):

Yeah I ran into this problem too among others recently, so I just forked the repo and fixed it myself for the purposes of the project I'm working on. You can build the CLI .dll and just run a local version of it instead of the globally installed tool.

@JimmyTheJ commented on GitHub (Dec 26, 2018): Yeah I ran into this problem too among others recently, so I just forked the repo and fixed it myself for the purposes of the project I'm working on. You can build the CLI .dll and just run a local version of it instead of the globally installed tool.
Author
Owner

@paillave commented on GitHub (Dec 26, 2018):

@JimmyTheJ Just saw that you actually mentioned it on a previous post. I didn't understand what you were talking about. I do now :)

@paillave commented on GitHub (Dec 26, 2018): @JimmyTheJ Just saw that you actually mentioned it on a previous post. I didn't understand what you were talking about. I do now :)
Author
Owner

@robertmuehsig commented on GitHub (Dec 28, 2018):

@paillave Would #194 help?

@robertmuehsig commented on GitHub (Dec 28, 2018): @paillave Would #194 help?
Author
Owner

@paillave commented on GitHub (Dec 28, 2018):

Thanks @robertmuehsig . According to me, this solves the issue. I'll make an attempt from the moment I'm front of my screen.

@paillave commented on GitHub (Dec 28, 2018): Thanks @robertmuehsig . According to me, this solves the issue. I'll make an attempt from the moment I'm front of my screen.
Author
Owner

@robertmuehsig commented on GitHub (Dec 28, 2018):

Thanks - if you hit any other blocking issues just let me know. I try to push a new version to NuGet.org tomorrow.

Thanks for your patience!

@robertmuehsig commented on GitHub (Dec 28, 2018): Thanks - if you hit any other blocking issues just let me know. I try to push a new version to NuGet.org tomorrow. Thanks for your patience!
Author
Owner

@robertmuehsig commented on GitHub (Dec 30, 2018):

0.0.11 with the fix should be ready on NuGet.org.

Hope this helps!

@robertmuehsig commented on GitHub (Dec 30, 2018): 0.0.11 with the fix should be ready on NuGet.org. Hope this helps!
Author
Owner

@paillave commented on GitHub (Dec 31, 2018):

Just tested, works great. Thx!

@paillave commented on GitHub (Dec 31, 2018): Just tested, works great. Thx!
Author
Owner

@hhfranzo commented on GitHub (Jan 9, 2019):

It is still not working under Windows. I just re-installed ElectronNET.CLI and updated the ElectronNET.API in the project (actually I tried with different projects), but I get the same message.

Under Linux (Ubuntu 18.04) I cannot say because I have another issue (with an mvc brand new project). I cannot install electron-package, because it doesn't find package.json.

@hhfranzo commented on GitHub (Jan 9, 2019): It is still not working under Windows. I just re-installed ElectronNET.CLI and updated the ElectronNET.API in the project (actually I tried with different projects), but I get the same message. Under Linux (Ubuntu 18.04) I cannot say because I have another issue (with an mvc brand new project). I cannot install electron-package, because it doesn't find package.json.
Author
Owner

@Lonka commented on GitHub (Jan 11, 2019):

It is still not working under Windows. I just re-installed ElectronNET.CLI and updated the ElectronNET.API in the project (actually I tried with different projects), but I get the same message.

I updated ElectronNET.CLI (0.0.11) and ElectronNET.API (0.0.11) as same as you, then build the application got the same error message. But I deleted obj\desktop\win and build again, it's working.

@Lonka commented on GitHub (Jan 11, 2019): > It is still not working under Windows. I just re-installed ElectronNET.CLI and updated the ElectronNET.API in the project (actually I tried with different projects), but I get the same message. > I updated ElectronNET.CLI (0.0.11) and ElectronNET.API (0.0.11) as same as you, then build the application got the same error message. But I deleted `obj\desktop\win` and build again, it's working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#244