Comments (2)
ive spent the day debugging this and i cant figure it out either?
its erroring out here
https://github.com/capacitor-community/electron/blob/f7ce86454469e967b41c1db8f51ddb942d278ca9/src/cli-scripts/common.ts#L91C76-L132
certainly this line
const t = require.resolve(pathSegments.join('/'), { paths: [root] });
from electron.
found the issue
if any of the packages sets main, module, types, etc...
in package.json
and they begin with ./
then it fails on the require.resolve
a work around is to remove the ./
from at least the main
value from package.json
inside that particular package!
working out why it does this?
CHATGPT reply:
The require.resolve
function in Node.js is used to resolve the path of a module. When you pass a module name to require.resolve
, Node.js searches for the module and returns the absolute path to the main entry point of the module.
Now, if the main
entry in the package.json
file of a module starts with ./
, it is treated as a relative path. This can cause issues when using require.resolve
because the module resolution process may not correctly handle relative paths when resolving the module.
Here's an example to illustrate the issue:
Consider the following package.json
:
{
"name": "example-module",
"main": "./lib/index.js"
}
If you use require.resolve('example-module')
, Node.js will try to resolve the module using the relative path ./lib/index.js
from the current working directory. This may not always work as expected, especially if the working directory is different from where the module is located.
To avoid this issue, it's recommended to specify the main
entry in package.json
without the ./
prefix:
{
"name": "example-module",
"main": "lib/index.js"
}
This way, require.resolve
will correctly resolve the module based on the module resolution algorithm without any potential issues related to relative paths.
If you provide more details about your specific use case or share some code snippets, I might be able to provide more targeted assistance.
from electron.
Related Issues (20)
- Electron outdated (end of support for 19.x) HOT 2
- not able to change default app icons. HOT 3
- Unhandled Promise: No such file or directory HOT 2
- please close. no longer needed.
- Plugin in same package as app HOT 3
- How to use electron plugins in capacitor electron project? HOT 1
- Is this project abandoned? HOT 3
- Livereload for Ionic Angular app HOT 1
- How to open external link in browser form electron app. HOT 3
- Ability to Enable Chrome Experimental Features: Web Share
- Installation for Nuxt.js 2 not working and ERROR for Login features.
- How to implement @electron/remote? HOT 3
- capacitor.config.json does not exist, did you setup capacitor in your project root? HOT 3
- Opening Electron platformError: undefined HOT 2
- Add capacitor v5 support HOT 1
- Lack of documentation for release 5.0.1 HOT 3
- Build error when using 5.0.1 HOT 7
- [CSP issues] refuses to load inline styles, I have no ideia what to add anymore.
- Add "skipLibCheck:true" to the generated tsconfig.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron.