How do I install gRPC for electron version 4.0.x - node.js

Installed electron#4.0.0 (also tried #4.0.7) and installed grpc and #grpc/proto-loader. When I launch electron I get a runtime error
Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v4.0-darwin-x64-unknown
Found: [node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Of course I tried running the suggested solution, npm rebuild, but that did not solve the problem. I also tried rebuilding the grpc module
npm rebuild grpc --build-from-source --runtime=electron --target=4.0.0 --target_archx64 --dturl=https://atom.io/download/electron
I tried uninstalling everything and starting from scratch. We're cloning the electron quick start repo and so after cloning and installing modules I installed grpc targeting a specific version
npm install grpc --runtime=electron --target=<electron version>
Which resulted in the same error so then I tried rebuilding
npm install --save-dev electron-rebuild // to rebuild grpc module
And if I delete node_modules and package-lock.json and then re-install npm install I get a success message (don't pay attention to the version, I'm watching my versions are matching) which looks like the "missing" module was installed
node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc]
Success: "/../electron/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" is installed via remote
protobufjs#6.8.8 postinstall /../electron/node_modules/protobufjs
node scripts/postinstall
electron#4.0.8 postinstall /../electron/node_modules/electron
node install.js

I found the answer here:
https://github.com/grpc/grpc-node/issues/762
Still, the solution I tried is the solution I needed. Not sure what I was doing wrong initially!
For future Googlers the summary is this:
The grpc_node module seems to be compiled for NODE_MODULE_VERSION=64,
but Electron 4 since 4.0.4 switched ... to
specifying NODE_MODULE_VERSION=69 and there is a mismatch at runtime
trying to load the module.
So, what I did to solve was
Clone the electron quick start repo
Uninstall the version of electron that came with quick start
Install electron#4.0.0
Install gRPC with target to 4.0.0
npm install grpc --runtime=electron --target=4.0.0

Related

error in npm start vs code , react project

H!
i tryin to run my React Project using npm start command in terminal :
npm v7.4.3
node v15.7.0
error in terminal
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
and face this error in localhost:8888
Failed to compile
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
i trying tso solve problem with this commands
npm rebuild node-sass
and other way was reinstall node-sass
im trying to delete node_modules and run npm install
but seem doesnt work for me.
any answers ?
Downgrade node.js to a stable version (LTS) like 14.15.4
Install the compatible node-sass version via npm install node-sass#5.0.0; you can find the list here or use the GitHub releases page, or even install gulp-sass with npm i gulp-sass`.

Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'

I am using the following book to build a MERN stack CRUD application. I'm having trouble installing and running graphql.
https://www.amazon.com/Pro-MERN-Stack-Development-Express-dp-1484243900/dp/1484243900/ref=mt_paperback?_encoding=UTF8&me=&qid= (published in 2019).
When I try to start the server contained in this repo https://github.com/vasansr/pro-mern-stack-2/tree/05.02-graphql-schema-file with the command npm start the app crashes and it returns an
Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'
I then followed some advice from a previous instance of this question on here to npm install karma-sinon-chai for the dependancies. But then I get the following error:
npm WARN apollo-graphql#0.4.4 requires a peer of graphql#^14.2.1 but none is installed. You must install peer dependencies yourself.
For me simply running npm install -g graphql fixed the problem (I had already installed Apollo globally with npm install -g apollo).
As per the error message apollo-graphql required a module from the graphql library validation/rules/PossibleTypeExtentions. The version of graphql I was using, as found by looking in my package.json, was "graphql":"^0.13.2".
I first tried to change this by changing my package.json to "^14.3.1". But after trying to install and run graphql I got the same error messages and when I looked in my package.json it had reverted back to "^0.13.2".
This may have been caused by my package.lock, locking me into that version. I then deleted package.lock, and node_modules folder.
I then ran the command nom install --save graphql#14.3.1, this worked fine.
I then just had to reinstall babel and Apollo-server-express and after this everything worked fine.

Unexpected end of JSON input error when creating new project

Each time I use angular/cli to create a new project by launching the following command
ng new Project-Name
I get the following error
npm ERR! Unexpected end of JSON input while parsing near '...-4","#angular/common"'
I tried to force clean the cache and re-try but still face the same problem.
NodeJS version: 12.16.3
npm version: 6.14.4
Angular CLI version: 9.1.4
OS: Windows 10 Home win32 x64
Edit: All the commands above I run them in Powershell as administrator
This is not a definitive answer but it looks like your global packages are corrupted in some way.
This bug may be caused by many different things. I suggest doing the following.
Install Node Version Manager (or NVM for Windows) and install Node version 10.16.1. This is enough for angular 9 and from my experience it is the most stable version for development. This should also change your NPM version so that may also help.
Uninstall global angular package npm uninstall -g #angular/cli
Force clear cache npm cache clean --force
Just to double check npm cache verify
You can also try clearing your %temp% and %roaming% AppData/npm-cache
install latest angular package npm install -g #angular/cli#<your-version>
if this error still occurs, consider using another shell
If this don't solve the problem try to manually locate the package.json file that is throwing an error and investigate.

react-native : cannot find module 'npmlog'

I am trying to install react native on my windows 7 PC,
but unfortunately an error occurred during installation saying
Error: Cannot find module 'npmlog'
npm install -g react-native-cli //Success
react-native init AwesomeProject//missing module
Note that my node version is 4.3.1
What is missing?!.
It sounds like you possibly have a conflict with your npm version and your node version.
Re-installing node usually solves this issue.
I won't list them all, but a google search of the error will throw up hundreds of results. You can try fixing paths yourself, but generally best just to let the node installer handle it.
Re-installing npm may also resolve the issue
npm install -g npm

Node not finding dependencies from Gruntfile

I've been using the Yeoman fullstack-angular generator, and it was working great about a week ago.
Now, after generating a new app, node is unable to add in the wired-in dependencies in the Gruntfile.js. Basically, I have to install all the dependencies that should be resolved with npm install. After installing about a dozen npm packages, like jit-grunt, jshint, etc, grunt build/serve will finish, but the app doesn't load in the browser.
I'm sure this is a node/npm issue, as the app generator was working about a week ago. I've tried completely uninstalling and reinstalling. Any guesses as to why this is happening?
Although I get the same behavior with different npm versions, right now I'm at:
npm : 3.3.12
node: 4.2.1
grunt-cli: 0.1.13
grunt: 0.4.5
I'm also getting this error message when I'm installing these packages manually, I feel like it might be related:
Ryans-MacBook-Pro:appTest nonzero$ npm install jit-grunt --save-dev
app-test#0.0.0 /Users/nonzero/Programming/appTEST
└── (empty)
npm ERR! code 1
Try to remove local node_modules folder, and then run npm cache clean. Maybe it will help.

Resources