I'm building a test Electron app where I clone an express server repo, with its own node_modules folder, into my Electron repo, also with its own node_modules folder. The contents of my app looks like this:
main.js (starts app and forks process from the express app's index.js)
node_modules
package.json
cloned-express-app
|
--node_modules
index.js
package.json
When I package my app for Mac with electron-builder (with or without asar enabled) the inner node_modules directory doesn't make it into the packaged app. Is there some magic that Electron is doing to eliminate that folder? Is there some way I can ensure that it gets in?
Here are the contents of my main.js and my package.json in case that helps.
This is caused by a bug in electron-builder that is present after version 20.15.0 and at least up to version 20.26.0. Install electron-builder#20.15.0 and this issue will be fixed.
Related
I am trying to make a webscrapping app using node js and electron. My app directory contains package.json file. So
When i run "npm install electron --sav-dev". It successfully installed electron in the root node_modules folder. Again when i run "npm install puppeteer", it successfully installed puppeteer in the root of node_modules folder. But this deletes several folders related to electron and the app stops functioning. So please help me how can i install modules in node_modules folder keeping them isolated from other modules..
image - Directory of my electron app
image- Electron installed in node_modules folder
I have the following folder structure:
Clearly React is using Jest in "Client" node_modules. If i try to install Jest for server node_modules (one lvl up), i will get error from React, saying i have duplicate packages up in the tree. How should i run tests for server with Jest? How should i install Jest for server? Or should i? Or i can use the same Jest react uses in "Client" folder? If so, how? What is the command? Really appreciate your help.
2 separate dependency trees, avoiding duplicate packages up in the tree would look like following:
server
├──> node_modules
├──> index.js
└──> package.json
client
├──> node_modules
├──> index.js
└──> package.json
.gitignore
README.md
Solved by using npm link client/node_modules/jest from project root .
i am trying to build a monorepo , which consist of a react and node js application so the frontEnd folder which is created using react app and backEnd folder which consist of all server code.
I have done the below steps
installed lerna globally
created a new folder and initialized the repository.
inside the new folder run lerna init, which created 2 files lerna.json, package.json and 1 folder as packages.
inside packages folder i run create-react-app frontEnd, it created a new react application
run the command mkdir backEnd, to created the backEnd folder in the packages folder
now my packages folder consist of two folders frontEnd and backEnd.
the frontEnd consist of a package.json which comes with create-react-app
questions
Do i need to remove the package.json from the frontEnd folder
how i configure the lerna.json and package.json in the root folder.
how can i run the application?
i have searched but i am not getting the solution to make a react-nodejs application with lerna using create-react-app
I did this task here
Do i need to remove the package.json from the frontEnd folder
No, each project in the /packages folder may have its dependencies. The modules installed in the root package.json are installed in all the subproject. When you run lerna bootstrap it will run npm install on each project.
how i configure the lerna.json and package.json in the root folder.
The lerna.json is quite simple and contains configuration that collects all the project lerna should manage.
The package.json is to track shared packages between all your project. For example you could have some constant-module that must be the same version on both the projects.
In a simple fontend/backend, it is realistic to don't have any shared modules.
how can i run the application?
when you run lerna run start, lerna will execute npm run start on all the tracked project. So you must be aware how to start you whole application.
In my example, I implemented the start only in the backend project since it will serve statically the frontend files and I didn't want to start another webserver only for the frontend.
I'm trying to use Yarn Workspaces to slit up my React. This is my folder structure.
React
packages
commonComponents
package.json
app 1
package.json
app 2
package.json
The commonComponents folder is installed into the node_modules of app 1 and app 2.
While my builds succeed, I'm not able to startup my node server. The following error is thrown:
I assume that babel doesn't transpile correctly. Any help?
What is the official method for causing the node_modules folder to be created in a subfolder? I am using Bower for client-side files and happily installing them under a "client" folder. It would be great to use NPM for server-side dependencies and follow the same pattern. For example:
MyApplication
client
bower_modules
server
node_modules
.bowerrc
package.json
server.js
According to the NPM documentation, it is acceptable to install node modules into a folder other than default location. Unfortunately, uses the --prefix option prevents the dependencies section of package.json from being populating... which leads me to believe this is not the proper way of doing this.
I would just do:
git mv package.json server # (or just mv if you aren't using git)
cd server
npm install
node_modules and package.json follows each other, so you would either have to move your package.json or move your node_modules to the root of your project.
You can still have your client and server folders, that is a good idea!
MyApplication
node_modules
express
socket.io
client
bower_components/jquery/jquery.js
client.js
server
server.js
.bowerrc
package.json
server.js