Grpc-node: windows versions are missing

Created on 20 Nov 2017  路  5Comments  路  Source: grpc/grpc-node

I have a node app that deploys to Windows Azure, it uses the googleapis and therefore the grpc, deployment on this environment has been working up until a few days ago and not deployment fails because node-pre-gyp cannot download pre-compiled versions of the file. I tried it with node 8.9.0 and it didn't work, I dialed it back to 8.0.0 as this was the last one that worked and it doesn't work either.

it doesn't work on my dev machine either, on node 9.2.0, windows 10, and this was working fine on 9.0.0 just a few days ago.

currently from azure instance forcing 8.0.0 it throws

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v11-win32-ia32.tar.gz 

node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v11 ABI) (falling back to source compile with node-gyp) 

any pointers on how to fix this?

Most helpful comment

As you can see, the difference is that the actual file exists in the directory with "v48" in its name, and it's looking in the directory with "v57" in its name. This means that you installed the package using Node 6 and you are trying to run it with Node 8. If you're having trouble getting those versions to match, one option would be to add a command line option when installing the package like this: npm install --target=8.0.0. It doesn't actually matter what minor version you specify there; only the major versions have to match.

All 5 comments

That error message says that you're trying to use Node 0.10. I don't think you're successfully forcing 8.0.0.

ok so, my package.json has

"engines": {
    "node": "8.0.0"
  },

I tried rebuilding by pieces and got it to do the npm install with no issues as before but now, when I try to access firebase-admin in the code, its throwing a separate issue when it tries to launch the express app:

Error: Cannot find module 'D:\home\site\wwwroot\node_modules\grpc\src\node\extension_binary\node-v57-win32-ia32\grpc_node.node'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\grpc\src\grpc_extension.js:30:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\grpc\src\client.js:38:12)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\node_modules\grpc\src\node\extension_binary\node-v57-win32-ia32\grpc_node.node'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\grpc\src\grpc_extension.js:30:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\grpc\src\client.js:38:12)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

if I look inside the node_modules to see what did npm installed, the grpc has the grpc_node.node under, so there is a discrepancy between whats expected and what's there

D:\home\site\wwwroot\node_modules\grpc\src\node\extension_binary\node-v48-win32-ia32>

just in case here is what my package.json looks like

{
  "name": "api",
  "version": "1.0.0",
  "private": true,
  "main": "dist",
  "scripts": {
    "build": "BABEL_ENV=production babel src -s -D -d dist --presets env,stage-0",
    "buildw": "SET BABEL_ENV=production && babel src -s -D -d dist --presets env,stage-0",
    "dev": "nodemon -w src --exec \"babel-node src --presets env,stage-0\"",
    "format": "prettier-eslint --write \"src/**/*.js\"",
    "start": "node dist",
    "scripts": "babel-node scripts --presets env,stage-0",
    "test": "mocha --timeout 30000 --compilers js:babel-core/register \"./test/**/*.test.js\""
  },
  "engines": {
    "node": "8.0.0"
  },
  "dependencies": {
    "async": "^2.6.0",
    "body-parser": "^1.18.2",
    "compression": "^1.7.1",
    "cors": "^2.8.4",
    "csv-parse": "^1.3.3",
    "express": "^4.16.2",
    "express-redis-cache": "git://github.com/leaffm/express-redis-cache.git",
    "firebase": "^4.6.2",
    "firebase-admin": "^5.5.0",
    "form-data": "^2.3.1",
    "google-auth-library": "^0.11.0",
    "google-cloud": "^0.57.0",
    "googleapis": "^22.2.0",
    "instagram-node": "^0.5.8",
    "moment": "^2.19.2",
    "morgan": "^1.9.0",
    "node-deezer": "^0.3.3",
    "node-fetch": "^1.7.3",
    "parse": "^1.10.2",
    "querystring": "^0.2.0",
    "redis": "^2.8.0",
    "sendgrid": "^5.2.3",
    "spotify-web-api-node": "^2.5.0",
    "stripe": "^5.3.0",
    "twitter": "^1.7.1"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.0.2",
    "babel-preset-env": "^1.6.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "chai": "^4.1.2",
    "chai-http": "^3.0.0",
    "eslint": "^4.11.0",
    "eslint-config-airbnb-base": "12.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-mocha": "^4.11.0",
    "mocha": "^4.0.1",
    "nodemon": "^1.12.1",
    "prettier-eslint": "^8.2.2",
    "prettier-eslint-cli": "^4.4.0",
    "sinon": "^4.1.2",
    "tinify": "^1.5.0"
  }
}

As you can see, the difference is that the actual file exists in the directory with "v48" in its name, and it's looking in the directory with "v57" in its name. This means that you installed the package using Node 6 and you are trying to run it with Node 8. If you're having trouble getting those versions to match, one option would be to add a command line option when installing the package like this: npm install --target=8.0.0. It doesn't actually matter what minor version you specify there; only the major versions have to match.

@murgatroid99 thanks for that, I can verify that doing it this way worked 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wenxiwu777 picture wenxiwu777  路  4Comments

kibertoad picture kibertoad  路  6Comments

yanbou893 picture yanbou893  路  5Comments

shotor picture shotor  路  3Comments

lucavallin picture lucavallin  路  5Comments