Cannot find module './server'
See original GitHub issueDescribe the bug
I have created a separate module that is an express server which is being started in the main i.e index.js file. The issue is that the imported module works fine when I do npm run electron:start
and the server listens but when I build it throws an exeption saying Cannot find module './server'
.
To Reproduce Steps to reproduce the behavior:
- Initialize a new capacitor project.
- Add electron using these steps
- Add a module in the
./src
and import it inindex.js
file. - Create build and run the app.
Expected behavior Compiled code from ./build folder should all go to production build.
Screenshots
production:
electron:start
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Version 85.0.4183.102 (Official Build) (64-bit)
Additional context By the way the app and server works find if I do everything in one file.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How do I resolve "Cannot find module" error using Node.js?
This happens when a first npm install has crashed for some reason (SIGINT of npm), or that the delay was too long, or...
Read more >Error: cannot find module [Node npm Error Solved]
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
Read more >Cannot find module 'X' error in Node.js
To solve the "Cannot find module" error in Node.js, make sure to install the package from the error message if it's a third-party...
Read more >How to resolve "Cannot find module" error in Node
The issue is that Node is unable to find the module that you are trying to import into your Node application. The most...
Read more >How to fix npm cannot find module error
The cannot find module error occurs because npm cannot find the module required by the index.js file. In this case, the axios module....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed with, 39a8e4b62d71d189b77d8d09ec4ee2626fd15939
This will be in 1.3.1
Hi IT-MikeS, thanks for your reply. Actually on my project, electron is not finding the express module, but it is included in node_modules (root and electron). Don’t know why it is happening.![Screen Shot 2020-12-12 at 13 04 33](https://user-images.githubusercontent.com/26283844/101988823-f9d38e00-3c7a-11eb-85d9-2fd841092867.png)