Node.js node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node - grpc-node

I was doing a proof of concept on gRPC using node.js
Here is my package.json
{
"name": "grpc-node-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"#grpc/proto-loader": "^0.1.0",
"grpc": "^1.11.0",
"lodash": "^4.6.1"
}
}
After writing in proto file, client and server files. When I run the command node server.js
I got the following error
PS C:\Learnings\node\grpc-nodejs-demo> node server.js
C:\Learnings\node\grpc-nodejs-demo\node_modules\grpc\src\grpc_extension.js:58
throw e;
^
Error: Failed to load C:\Learnings\node\grpc-nodejs-demo\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node. \\?\C:\Learnings\node\grpc-nodejs-demo\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node is not a valid Win32 application.
\\?\C:\Learnings\node\grpc-nodejs-demo\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Learnings\node\grpc-nodejs-demo\node_modules\grpc\src\grpc_extension.js:32:13)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
PS C:\Learnings\node\grpc-nodejs-demo>
Any thoughts??

After some research, I did the following steps to resolve the issue
I was missing node-gyp - which is Node.js native addon build tool. It can be installed by
npm install -g node-gyp
Install Python
Install Visual C++ Build Environment
Clean up node-modules
Then do in the folder npm install
The following link talks the above steps in detail:
https://github.com/nodejs/node-gyp#on-windows

Related

new gatsby project is not running

I've created new gatsby project. After successful installation, I tried to run it with command npm run develop and gatsby develop but it is throwing error. Unable to figure out the root cause of error. I tried re installing node_modules but nothing is working! Please Help! Thank you!
ERROR:
D:\FC\gatsby-shopify-site>npm run develop
> test-site#1.0.0 develop
> gatsby develop
D:\FC\gatsby-shopify-site\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
throw ex;
^
Error: The specified module could not be found.
\\?\D:\FC\gatsby-shopify-site\node_modules\#parcel\source-map\parcel_sourcemap_node\artifacts\index.win32-x64-msvc.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1185:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\FC\gatsby-shopify-site\node_modules\#parcel\source-map\parcel_sourcemap_node\index.js:15:18)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\FC\gatsby-shopify-site\node_modules\#parcel\source-map\dist\node.js:14:18)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
package.json
{
"name": "test-site",
"version": "1.0.0",
"private": true,
"description": "test-site",
"keywords": [
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean"
},
"dependencies": {
"gatsby": "^4.9.0",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
}
gatsby-config.js
module.exports = {
siteMetadata: {
siteUrl: `https://www.yourdomain.tld`,
},
plugins: [
]
}
PLEASE HELP!!!
I have solved the issue by adding a library of Microsoft Visual C++ 2015 Redistribution on my computer as the package is failing due to a missing library.
The download link is here: https://aka.ms/vs/17/release/vc_redist.x64.exe
It took a lot of time for mine to solve. Hope that it will help you.
Where (in what folder) have you run npm install?
In D drive and inside FC folder
You must install your dependencies inside your project folder, so inside gatsby-shopify-site. In your case, you installed your dependencies in the parent folder (FC),
Move inside D:\FC\gatsby-shopify-site and run:
npm install
Once done:
gatsby develop
Make sure you installed the right node js version for your Windows system.
As mentioned in the error, it is trying to execute a win32-x64 version. In my case Node website recommended the wrong version when downloading and this was fixed by changing it.
Error: The specified module could not be found.
\\?\D:\FC\gatsby-shopify-site\node_modules\#parcel\source-map\parcel_sourcemap_node\artifacts\index.win32-x64-msvc.node
Could you try yarn instead?
npm install -g yarn
and then run your command like this
yarn run develop

Yarn start - Command failed with exit code 1

I'm having a little problem while trying to run "Yarn start" in my ReactJS project.
The error is pasted below:
yarn run v1.22.5
$ webpack-dev-server --mode development
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\3AM\web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\3AM\\web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I've tried to install webpack-dev-server with npm and yarn, but it didn't solve.
In package.json change the start script to "start": "webpack serve".

Error: webpack-dev-server with ReactJS and Django

I try to create a full stack environment with Django + ReactJS. Here, I use Webpack bundler and I'm getting this error while I try to run my webpack-server from a virtualenv. I'm very new to the application development and this is my first attempt, So can anyone help me out?
PS C:\Users\NikhileshSubramanian\Desktop\eduWebApp\env\frontend> npm run dev
frontend#0.1.0 dev C:\Users\NikhileshSubramanian\Desktop\eduWebApp\env\frontend
webpack-dev-server
module.js:549
throw err;
^
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\NikhileshSubramanian\node_modules\html-webpack-plugin\lib\compiler.js:9:28)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#0.1.0 dev: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\NikhileshSubramanian\AppData\Roaming\npm-
cache\_logs\2018-09-29T07_48_56_942Z-debug.log
Scripts inside my package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"buildwebpack": "webpack",
"dev": "webpack-dev-server"
},
"devDependencies": {
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.9"
}
Project Working Directory
https://i.stack.imgur.com/z1v0p.png
I saw that you are using windows system.So maybe you need configure environment variables for this "webpack/lib/node/NodeTemplatePlugin" module. Then it can find the module.
Webpack is inbuilt in React modules when we create a project via create-react-app. That's how Facebook has developed to reduce concentrating about environment setup and look into building the application. So, there's an easy way to create our project avoiding Webpack initiation.
Refer:
https://www.techiediaries.com/react-tutorial/

React/webpack application deploy fails on heroku

I am trying to deploy my react starter on heroku. I have written the webpack file and it works on my localhost but as I deploy on heroku it throws a run time error of:
Cannot find module '../lib/util/addDevServerEntrypoints'
My stacktrace looks like
Error: Cannot find module '../lib/util/addDevServerEntrypoints'
2017-03-28T11:56:47.036328+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15)
2017-03-28T11:56:47.036329+00:00 app[web.1]: at Function.Module._load (module.js:417:25)
2017-03-28T11:56:47.036329+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-03-28T11:56:47.036330+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-03-28T11:56:47.036330+00:00 app[web.1]: at Object. (/app/node_modules/webpack-dev-server/bin/webpack-dev-server.js:9:33)
2017-03-28T11:56:47.036331+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T11:56:47.036331+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T11:56:47.036332+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T11:56:47.036333+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-03-28T11:56:47.036333+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
I have faced similar problems while deploying my app in heroku.
It's best to write a node express server that serves public folder to deploy your app rather than using webpack-dev-server.
Node express server can be easily created like following.
const express = require('express')
const path = require('path')
const app = express()
app.use(express.static(path.resolve(__dirname,'dist')
app.listen(process.env.PORT || 8080)
web-dev-server is meant to be used only in development mode. Use "serve" instead.
Do npm install serve --save or yarn add serve -D
Add the following scripts to your package.json
"scripts": {
"start": "serve -s dist",
"dev": "webpack-dev-server --mode development --inline --open --hot",
"build": "webpack --mode production",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
Before deployment run, npm build, or yarn build for the Webpack to generate your static files. Then push normally to Heroku. Once the deployment build succeeds, Heroku runs the start script. This way it would use "serve" to serve you static files created in the dist folder. So you use Webpack-dev-server for dev purpose and "serve" in production. Either way serving the dist folder files through node also works. Cheers

Error: Cannot find module 'js-yaml' when running "bower install"

I am walking through basic set up of an AngularJS application (Just getting started) and am currently trying to install Bower components for the application.
When I run bower install from the terminal, I get the following error:
Error: Cannot find module 'js-yaml'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (Path\bower\node_modules\configstore\index.js:9:12)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I haven’t specified js-yaml module anywhere in my scripts (as far as I am aware), so not sure where this dependency is coming from.
I have tried deleting the node_modules folder, clearing the npm cache, including js-yaml within the package.json file then re-running npm install, but I get the same error when running bower install
If it helps, my bower.json and package.json files are shown below:
Bower.json
{
"name": "starter-node-angular",
"version": "1.0.0",
"dependencies": {
"bootstrap": "latest",
"font-awesome": "latest",
"animate.css": "latest",
"angular": "latest",
"angular-route": "latest"
}
}
package.json
{
"name": "starter-node-angular",
"main": "server.js",
"dependencies": {
"express" : "~4.5.1",
"mongoose" : "~3.8.0",
"body-parser" : "~1.4.2",
"method-override" : "~2.0.2",
"js-yaml" : "latest"
}
}
I am using WebStorm 10.0.4 (empty project as the starting point).
Has anyone come across this or a similar issue and possible point me in the right direction on how to resolve the issue?
Running sudo npm install -g js-yaml first should get you in the right direction.
My guess is that its not related to your application but bower is broken. Try reinstall it:
$ npm uninstall bower
And then reinstall it like this:
$ npm install -g bower
That solved it for me.

Resources