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?
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 have tried to deploy my Nestjs deploying on IIS server. I have configured iisnode on IIS that works fine for express application but I am getting errors for missing modules for nestjs. I have tried following commands for building production package
npm run start:prod
and
npm run webpack
but failed to deploy on IIS. How can I build a deployment package?? so I can deploy. I am new with nodejs and Nestjs.
Look at the project's package.json. You'll see that start:prod is a script that runs node on the compiled output of the project. You get the compiled output by running:
npm run prestart:prod
that will re-build your app into the dist folder.
So you can
Zip up the dist folder
deploy to the target host
Unzip it
Try running iisnode on it
let me know how that works
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.