1

I have been following the tutorial: https://docs.particle.io/tutorials/integrations/google-cloud-platform/

trying to send humidity and temperature data from a Particle Photon to Google Cloud Datastore. The high level architecture is as follows:

enter image description here

where data is sent from the Photon to Particle Cloud to Google Cloud (Pub/Sub) and to Google Datastore with Node.js as an intermediary.

Everything works to Pub/Sub but as I try to activate the node script (calling: node tutorial.js) I receive errors.

When calling node tutorial.js I receive:

$ node tutorial.js 
Authenticating with Google Cloud...
/home/lennart/node_modules/grpc/src/grpc_extension.js:55
    throw error;
    ^

Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v64-linux-x64-glibc
Found: [node-v57-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/home/lennart/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node'
    at Object.<anonymous> (/home/lennart/node_modules/grpc/src/grpc_extension.js:53:17)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/lennart/node_modules/grpc/src/client_interceptors.js:145:12)
    at Module._compile (internal/modules/cjs/loader.js:702:30)

I tried npm rebuild as suggested in the error message, but this made no change.

Current versions of different packages:

$ npm -v  
6.1.0

$ node -v
v10.4.1

$ openssl version -v
OpenSSL 1.0.2o  27 Mar 2018

Previously I had problems with OpenSSL and Node compatability, which could be traced from: Error undefined symbol: SSL_library_init. Node v10.4.1 was installed which then seemed to cause the above error.

4 Answers 4

2

I finally solved this by doing the following:

  • Making sure the right version of Node was installed:

    npm install --target=10.0.0 --target_platform=linux --target_arch=x64

  • Copying the folder node-v64-linux-x64-glibc to two other folders (see below) apart from where it initially had been installed (/home/lennart/Desktop/Cloud/google-cloud-datastore-tutorial-master/node_modules/grpc/src/node/extension_binary) via the previous command.

/home/lennart/node_modules/@google-cloud/video-intelligence/node_modules/grpc/src/node/extension_binary /home/lennart/node_modules/grpc/src/node/extension_binary

This could probably be solved in a more elegant way, but at least it worked.

Sign up to request clarification or add additional context in comments.

1 Comment

I've been trying to resolve this for two days and - although I didn't need to follow the 2nd step you outlined, of manual copying - the use of the --target** flags on an npm install is the only thing that finally fixed this issue. Thanks for sharing that bit and death to firebase!!
0

I am experiencing the same issue with node:10-alpine base image in Docker. The solution that works for me is running additionally npm rebuild on the container's entry point.

FROM node:10-alpine WORKDIR /app COPY package*.json . RUN npm install COPY . . CMD npm rebuild && npm run migrate:run

Probably running the same npm rebuild should resolve the issue locally, or, perhaps this is a problem with npm as it cannot fetch the proper binary timely. Would yarn make a difference?

2 Comments

I suspect there is a problem with npm. Some have resolved the issue by running 'npm rebuild' several times. The above problem has returned after an update, however, instead of "Expected directory: node-v64-linux-x64-glibc" it now says "Expected directory: node-v59-linux-x64-glibc". It cannot be solved with the same method apparently..
The new problem with "expected directory node-v59-linux-x64-glibc" was solved by using NVM (Node Version Manager) to install an older version of Node (8.11.3, which is the stable version at the moment). This resulted in error "expected directory node-v57-linux-x64-glibc", which was solved in same manner as my previous answer to the problem: by copying the folder from where it was installed to the two other directories.
0

Please check the NODE&NPM version of reguler user and SUPER USER NODE&NPM versions are same.

Comments

0

For me a simple yarn --force did it, once I used nvm to switch to the proper node.js version. I had originally done yarn with the wrong version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.