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

Issue while using from .asar package #60

Closed
jrsarath opened this issue Sep 6, 2018 · 9 comments
Closed

Issue while using from .asar package #60

jrsarath opened this issue Sep 6, 2018 · 9 comments

Comments

@jrsarath
Copy link

jrsarath commented Sep 6, 2018

Hi there,
im developing a Electron app,
and facing this issue :
Condition : packaged app with asar - error thrown = Input Error: Can not find script file APPD_DIR\resources\app.asar\node_modules\regedit\vbs\regList.wsf

#APP_DIR represents current project folder

@XinYueStudio
Copy link

package.json package:win add --ignore=node_modules/regedit/vbs --extraResource=node_modules/regedit

script add function like this:

let regedit = require('regedit')
regedit.setExternalVBSLocation('resources/regedit/vbs');

@jeremysu0131
Copy link

First, set the following code in package.json in build

    "extraResources": [
      {
        "from": "node_modules/regedit/vbs",
        "to": "regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]

Second, set the following code where you use regedit

let regedit = require('regedit');
regedit.setExternalVBSLocation('resources/regedit/vbs');

@mohsenmahoski
Copy link

mohsenmahoski commented Jan 14, 2020

First, set the following code in package.json in build

    "extraResources": [
      {
        "from": "node_modules/regedit/vbs",
        "to": "regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]

Second, set the following code where you use regedit

let regedit = require('regedit');
regedit.setExternalVBSLocation('resources/regedit/vbs');

you saved my life!! thank u!

@ghost
Copy link

ghost commented Jan 17, 2020

I still cant figure this out.
I created a entry in package.json for extraResources

"name":...
"author":...
"scripts":...
"build": {
    "extraResources": [
      {
        "from": "node_modules/regedit/vbs",
        "to": "src/regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]
  },

Then i added regedit.setExternalVBSLocation('src/regedit/vbs'); in my code.

With these or without I get the same error:
Input Error: Can not find script file "C:\.....\dist_electron\vbs\regList.wsf".

What am I doing wrong?

@jeremysu0131
Copy link

jeremysu0131 commented Jan 17, 2020

I still cant figure this out.
I created a entry in package.json for extraResources

"name":...
"author":...
"scripts":...
"build": {
    "extraResources": [
      {
        "from": "node_modules/regedit/vbs",
        "to": "src/regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]
  },

Then i added regedit.setExternalVBSLocation('src/regedit/vbs'); in my code.

With these or without I get the same error:
Input Error: Can not find script file "C:\.....\dist_electron\vbs\regList.wsf".

What am I doing wrong?

Looks like your file URL was wrong. It should be:
${builded file location}\win-unpacked\resources\regedit\vbs\regList.wsf

By the way, I used election-builder to build my project

@rendomnet
Copy link

@jeremysu0131 Input Error: Can not find script file "C:\Users***\src\vbs\regList.wsf".
same error what is url?

@rendomnet
Copy link

@jeremysu0131 setExternalVBSLocation is not working for me. It always searching in src\vbs\

@A-ANing
Copy link

A-ANing commented Jul 14, 2023

First, set the following code in package.json in build

    "extraResources": [
      {
        "from": "node_modules/regedit/vbs",
        "to": "regedit/vbs",
        "filter": [
          "**/*"
        ]
      }
    ]

Second, set the following code where you use regedit

let regedit = require('regedit');
regedit.setExternalVBSLocation('resources/regedit/vbs');

If the application is manually started, it can solve the problem; If it starts automatically upon startup, the same error will be reported;

After I set the enable self start option, this method failed and still reported the same error;

Boot self start code:

app.setLoginItemSettings({
            openAtLogin: true,
            openAsHidden: false
        });

Is there someone kind-hearted to help me

@davec-fvr
Copy link

For me, I had to add this to the end of electron-builder/config.js rather than in package.json

  extraResources: [
    {
      from: 'node_modules/regedit/vbs',
      to: 'regedit/vbs',
      filter: ['**/*'],
    },
    {
      from: './assets',
      to: './assets',
      filter: ['**/*'],
    },
  ],

and then this as @jeremysu0131 said

let regedit = require('regedit');
regedit.setExternalVBSLocation('resources/regedit/vbs');

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

8 participants