question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to include non-Electron folders in my NSIS installer distribution

See original GitHub issue
  • 19.45.4:

  • Windows 7:

Trying to include the following folders in my NSIS-installer distro:

C:\myelectronapp\javaprograms_1\

C:\myelectronapp\javaprograms_2\

The final result should be that these folders (and their contents) would be installed under (in) my Electron project.

My installer.nsh file is such:

!macro preInit SetRegView 64 WriteRegExpandStr HKLM β€œ${INSTALL_REGISTRY_KEY}” InstallLocation "C:" WriteRegExpandStr HKCU β€œ${INSTALL_REGISTRY_KEY}” InstallLocation "C:" SetRegView 32 WriteRegExpandStr HKLM β€œ${INSTALL_REGISTRY_KEY}” InstallLocation "C:" WriteRegExpandStr HKCU β€œ${INSTALL_REGISTRY_KEY}” InstallLocation "C:" File /r javaprograms_1
File /r javaprograms_2
!macroend

But I get the error no files found

Being new to NSIS I suspect I am using the File (or placing the File) clause incorrectly. Any assistance would be appreciated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

4reactions
phuzecommented, Nov 27, 2017

Yes, you would need to include every file in your project by including them in your package.json file. Maybe this might be a better approach to organizing your project structure:

myProject/
β”‚
β”œβ”€β”€ myElectronApp/
β”‚   β”œβ”€β”€ javaprograms_1/
β”‚   β”‚   └── #whatever this is
β”‚   β”œβ”€β”€ javaprograms_2/
β”‚   β”‚   └── #whatever this is
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   └── batman.js
β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   └── batman.css
β”‚   β”œβ”€β”€ images/
β”‚   β”‚   └── batman.jpg
β”‚   β”œβ”€β”€ index.html
β”‚   └── main.js
β”‚
β”œβ”€β”€ node_modules/
β”‚   └── #a boatload of node modules, including bootstrap
β”‚
β”œβ”€β”€ package.json

Which would allow you to include your entire app folder, as such:

{
    "name": "myelectronapp",
    "version": "1.0.0",
    "author": "Batman <bat@man.com>",
    "build": {
        "files": [
            "myElectronApp/**/*",
            "node_modules/**/*",
            "package.json"
        ],
    }
}

To include jQuery and Bootstrap, include them in your index.html as so:

<html>

    <head>

        <title>Batman</title>
        <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
        <link rel="stylesheet" href="styles/batman.css">

    </head>

    <body>

        <img src="images/batman.jpg" alt="Because I'm Batman..." />

        <script src="../node_modules/jquery/dist/jquery.min.js"></script>
        <script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="scripts/batman.js"></script>

    </body>

</html>

Refer here for an example main.js file.

Edit:

Note:

devDependencies are npm packages that are only installed locally on your computer. If you were to try and send your program to someone else, in the form of a compiled application (.exe, .dmg, etc), then those dependencies would not be available on their computer. dependencies on the other hand, are included with your compiled application. I bring this up because I’m taking a stab in the dark and assuming something like string-search would be used within your application.

If this has helped resolve your issue, please report back as such and close this issue. Thank you πŸ˜ƒ

3reactions
phuzecommented, Nov 29, 2017

Is it important that you package things into an asar archive? If not, you could always disable it:

"build": {
    "asar": false
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Include non-electron folder as part of the NSIS installation
I believe it's a location issue, that is, that the NSIS script cannot locate the additional_files/ folder. I've tried modifying the package.jsonΒ ...
Read more >
Chapter 2: Tutorial: The Basics - NSIS - SourceForge
Header files that reside in the Include directory under your NSIS directory can ... For example in the NSIS distribution installer you can...
Read more >
Using NSIS to Build Application Installers
Create a folder under your new project folder ("MyFirst") with the same name you want as the name for your installer's default directory....
Read more >
Installing NSIS - All platforms - Apache Software Foundation
The NSIS installer compiler will work under Linux and MacOSX but you will have to download the source and compile it yourself. If...
Read more >
Inspecting the Output of an Electron-Builder Windows ...
The goal of inspecting the installer, would be to see which actions ... folder into nsis-<version>\ , it is now time to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found