@yao-pkg/pkg 5.14.1 → 5.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/package.json +1 -1
- package/prelude/bootstrap.js +2 -1
package/README.md
CHANGED
|
@@ -402,6 +402,23 @@ await exec(['app.js', '--target', 'host', '--output', 'app.exe']);
|
|
|
402
402
|
|
|
403
403
|
## Troubleshooting
|
|
404
404
|
|
|
405
|
+
### Error: Cannot find module XXX (when using `child_process`)
|
|
406
|
+
|
|
407
|
+
When using `child_process` methods to run a new process pkg by default will invoke it using NodeJS runtime that is built into the executable. This means that if you are trying to spawn the packaged app itself you will get above error. In order to avoid this you must set `PKG_EXECPATH` env set to `""`:
|
|
408
|
+
|
|
409
|
+
```js
|
|
410
|
+
const { spawn } = require('child_process');
|
|
411
|
+
|
|
412
|
+
const child = spawn(process.execPath, [process.argv[1]], {
|
|
413
|
+
env: {
|
|
414
|
+
...process.env,
|
|
415
|
+
PKG_EXECPATH: '',
|
|
416
|
+
},
|
|
417
|
+
});
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
More info [here](https://github.com/yao-pkg/pkg/pull/90)
|
|
421
|
+
|
|
405
422
|
### Error: ENOENT: no such file or directory, uv_chdir
|
|
406
423
|
|
|
407
424
|
This error can be caused by deleting the directory the application is
|
package/package.json
CHANGED
package/prelude/bootstrap.js
CHANGED
|
@@ -2006,7 +2006,8 @@ function payloadFileSync(pointer) {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
const opts = args[pos];
|
|
2008
2008
|
if (!opts.env) opts.env = _extend({}, process.env);
|
|
2009
|
-
|
|
2009
|
+
// see https://github.com/vercel/pkg/issues/897#issuecomment-1049370335
|
|
2010
|
+
if (opts.env.PKG_EXECPATH !== undefined) return;
|
|
2010
2011
|
opts.env.PKG_EXECPATH = EXECPATH;
|
|
2011
2012
|
}
|
|
2012
2013
|
|