nrwl nx angular Can't resolve 'child_process' - node.js

I'm using https://nx.dev/angular to develop a microservice app but now I'm getting the following errors:
ERROR in /home/vagrant/document-registry/node_modules/#graphql-tools/git-loader/index.esm.js
Module not found: Error: Can't resolve 'child_process' in '/home/vagrant/document-registry/node_modules/#graphql-tools/git-loader'
This particular subproject is an Angular app and I don't know how to prevent node modules that are not part of the browser API from being packaged since the entire application is being used with one package.json file. I'm running this in a vagrant environment.
Can anyone point me in the right direction on this?

Related

errors: does not provide an export named when using vite in grpc-web project

I'm trying to use vite
I've some JavaScript-generated files for GRPC communication; alongside each file, there is a declarative file because I'm using React with TypeScript. When running Vite, I get this error:
Uncaught SyntaxError: The requested module '/src/grpc-web/offboard/dashboard/web_vantage_server/proto/display_option_pb.js' does not provide an export named 'DisplayOption'
Anybody has encountered this issue and has a solution?
Thanks

create react app not working Module Error (from ./node_modules/postcss-loader/dist/cjs.js):

create react app is not working recently and I get this error
Node couldn't find your project's modules. Have you tried
npm i

Babel Loader doesnt compile my own NPM package in react app

Ive only been learning Javascript/Typescript since the start of the year as I decided to create a group of microservices that are all linked together. I have my own API created in nestJS and found that whenever I wanted to call the API from each microservice i was repeating the same code over and over again so I moved it all into its own separate package which I can use.
Every other project I have which uses my npm package does not cause any errors and works fine however these projects are done using babel. I decided to implement my new package into my react frontend project but whenever I import the package and try to use it I get an error
SyntaxError: D:\Projects\Node\Lab Maker\redditbot-frontend\node_modules\labmaker-api-wrapper\lib\utils\BaseAPI.js: Missing class properties transform.
I managed to fix this issue by installing the babel class transform package but then was presented with another error.
Failed to compile.
./node_modules/labmaker-api-wrapper/lib/utils/BaseAPI.js 13:9
Module parse failed: Unexpected token (13:9)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
| class API {
> APIBase;
| APIUrl = 'http://localhost:3000';
|
I'm not sure what is wrong with my package or what causes this error but if anyone is able to take a look at the source code for my npm module and explain how I would fix this issue that would be helpful. https://github.com/LabMaker/API-Wrapper
this is the npm package https://www.npmjs.com/package/labmaker-api-wrapper

pg-promise in Angular app gives many 'Module not found' errors

I am including pg-promise in my Angular app to make some queries.
My app is targeting browsers and I am willing to deploying it via ng build --prod.
However, when I launch the development server with Angular CLI using ng serve I get lots of errors and my app does not work since I imported pg-promise with:
import * as pgPromise from 'pg-promise';
Errors are like Module not found: Error: Can't resolve 'XXX' in 'path.
I tried to solve with the solutions provided in this answer:
Open src/tsconfig.app.json*.
Add "node" to the "types" array.
, and installing node types via npm i #types/node, but nevertheless I am still hitting the same errors.
Finally, lookig at the types declared in the pg-promise.d.ts file, I can clearly see there's an error which makes me think is the cause of the problems I am having. VScode is telling me that it Cannot find namespace 'NodeJS'.ts(2503).
Any suggestion on how I should include pg-promise in my app without all these errors?

Heroku: Error: Cannot find module 'indexof'

I have a node.js application that uses socket.io and express. When I deploy the application I get the error Cannot find module 'indexof'. I read about the issue here but the thing is that I don't check-in my node_modules folder to heroku so not really sure how I can fix it. Any ideas ?

Resources