Issue while using from .asar package
jrsarath opened this issue Β· 9 comments
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
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');
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');
First, set the following code in
package.json
inbuild
"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!
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?
I still cant figure this out.
I created a entry inpackage.json
forextraResources
"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
@jeremysu0131 Input Error: Can not find script file "C:\Users***\src\vbs\regList.wsf".
same error what is url?
@jeremysu0131 setExternalVBSLocation
is not working for me. It always searching in src\vbs\
First, set the following code in
package.json
inbuild
"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
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');