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:
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.
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.
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?
Please check the NODE&NPM version of reguler user and SUPER USER NODE&NPM versions are same.
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.
Related
I am trying to deploy functions to firebase using my Mac M1, for which it was required to do an npm install to install packages in node_modules/.
I am getting this error:
Error: 'darwin-arm64v8' binaries cannot be used on the 'darwin-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'darwin-x64' platform.
at Object.hasVendoredLibvips (/Users/ali/Desktop/tajir/backend-mvp/appengine/back-end-flex/node_modules/sharp/lib/libvips.js:80:13)
at Object.<anonymous> (/Users/ali/Desktop/tajir/backend-mvp/appengine/back-end-flex/node_modules/sharp/lib/constructor.js:7:22)
at Module._compile (internal/modules/cjs/loader.js:1136:30)
at Module._compile (pkg/prelude/bootstrap.js:1394:32)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)
at Module.load (internal/modules/cjs/loader.js:984:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1024:19)
at Module.require (pkg/prelude/bootstrap.js:1338:31)
at require (internal/modules/cjs/helpers.js:72:18)
Usually someone having a Mac M1 would have this issue. The Mac M1 processor is arm64. There was a solution posted here which requires to change terminal architecture to arch -x86_64 zsh which I did not want to do.
So, that's the workaround I was able to discover (some of the steps also mentioned in the error):
rm -rf node_modules/sharp
npm install --arch=x64 --platform=darwin sharp
For me, all I had to do was:
brew reinstall vips
then do a clean install of the project.
My answer is not related to deploying functions to firebase, but I had that exact same error:
Error: 'darwin-x64' binaries cannot be used on the 'darwin-arm64v8' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'darwin-arm64v8' platform.
when I tried to run a project with a mac M1 using a version of node that was incompatible.
I tried to run the project with version 16 when the project actually require version <=14.
So if anyone has this problem might be worth checking the node version
For some reason I got it fixed with removing node_modules and installing them again.
Error: 'darwin-x64' binaries cannot be used on the 'darwin-arm64v8' platform.
Please remove the 'node_modules/sharp' directory and run 'npm install' on the
'darwin-arm64v8' platform.
I got this error today spinning up a Gatsby app locally. Reverting to the Node version that I used when installing the originally Gatsby application worked for me to get past it. Switched from Node v16 to v14.20.
I have a ReactJS project and I was trying to use some of the PrimeReact components. At some point, I faced an error (can't remember exactly which one) and I tried to run an older version of NPM in a copy of my main directory.
Now, I get this error every time, even when I run npm command.
I've already tried to delete my node_modules folder, delete my project and clone it back from GitHub and also to reinstall NodeJS several times. I don't know what to do!
I have Windows 10 and I'm using NodeJS v12.16.0.
Thanks to anyone that offers some help
Update: I have never installed gulp. I suppose that maybe some dependency is using it but, because I can't run any npm command, I can't remove them D:
The error:
C:\Users\Carlos>npm
evalmachine.<anonymous>:35
} = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:35:5
at Object.<anonymous> (C:\Users\Carlos\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\node_modules\graceful-fs\fs.js:12:1)
at Module._compile (internal/modules/cjs/loader.js:1157:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
at Module.load (internal/modules/cjs/loader.js:1001:32)
at Function.Module._load (internal/modules/cjs/loader.js:900:14)
at Module.require (internal/modules/cjs/loader.js:1043:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Carlos\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1157:30)
It might be an error related with gulp and node v12 conflict. If you have the gulp installed globally in your environment and you can uninstall without problems, you can try it. To help with commands, check if you have the gulp installed, typing this in your command line interface:
gulp -v
Uninstall your version:
npm uninstall -g gulp
Using Mac terminal and trying to run a Gatsby site, I am running into a problem.
As far as I found out, it is becase of an old version of Node. Particularly, "Node 6.* doesn't natively support async operations".
Just out for curiosity, the error I get when installing the app is:
async sendEvents() {
^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/index.js:3:19)
So it looks like a matter of just upgrading.
Here comes the tricky part.
When I run npm -v, I get this output: 6.12.0. Ok, all looks coherent. I get the error because I have version 6.
Then I go brew upgrade npm and check out the output: Error: npm 12.11.1 already installed.
Any comments?
I think you should get the latest stable version of node instead ([Download Node])1, because the brew upgrade npm command only upgrades npm. When you download the .dmg file for Node, you get the latest stable version for Node and NPM.
Then, the npm -v just returns the version of npm you currently have installed on your machine and the real version (will assume node -v) is the version of node js running on your machine.
NPM is the Node Package Manager. It is not the same as Node itself. To get the current version of Node that's running, node -v will tell you.
Node and npm are individual modules if you will. You do get npm installed with NodeJS, But they can be installed separately as well.
So you can end up with two different versions of each.
In addition, you can have node and npm installed locally. Or you could have node and npm installed with homebrew. (in a cellar) In which case you end up with two separate installs. So you may need to check which install is being actively used.
In your case, check what node version you have first.
node --version
and then you can go from there. If it matches npm version, check what path is linked when you type npm or node.
You may potentially use which command to see which installation is currently being used.
which node
above command should give you path, copy that path
and run
ls -l [copied-path]
output from ls -l should give you a path that will tell you which installation is being used.
If above path does not point to brew path, I believe you can run brew link to change that path
brew link node
I've spent a couple of days trying to run a build app from Meteor on my Synology ds213j (Armv7, 512MB ram).
I keep encountering the following error
## There is an issue with `node-fibers` ##
`/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/bin/linux-arm-57/fibers.node` is missing.
Try running this to fix the issue: /volume1/homes/user/.nvm/versions/node/v8.11.2/bin/node /volume1/homes/user/app/bundle/programs/server/node_modules/fibers/build
Error: /volume1/homes/user/app/bundle/programs/server/node_modules/fibers/bin/linux-arm-57/fibers.node: internal error
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:13:39)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:22
throw new Error('Missing binary. See message above.');
^
Error: Missing binary. See message above.
at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:22:9)
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)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/boot.js:1:75)
at Module._compile (module.js:652:30)
BUT, fibers.node actually EXIST!
What I did before:
build meteor app meteor build --server-only --architecture os.linux.x86_32
on the /program/server folder npm install --production
npm install fibers
What I tried to fix it:
go to /programs/server/ and run npm install fibers (and reinstall)
installing from source following the instructions on
https://www.npmjs.com/package/fibers
my meteor app uses Node 8.11.2 but the only node version available for synology is 8.9.4. Removed it and manually installed the 8.11.2
build an default meteor app to check if is my app giving problems.
Nothing worked so far and I have no idea what to do next.
I suspect the problem is that fibers is built for linux-arm-57 and I suppose I need arm-7I?
There is something I can do to make this work?
Thanks!
In the following I describe the way you correctly deploy your app to an ARMv7 device. By doing so I will highlight important steps that may often be cause of errors. I hope your problem will solve by reproducing these steps.
1. Build your production app
Make sure the app starts, runs and all your tests pass on local.
Get your current development version of node. Note, that it varies, depending on the meteor version your project uses. Note: The meteor guide on custom deployment underlines the importance of a matching node version.
$ cd ~/path/to/meteor-project
$ meteor node -v
v8.9.4 # this example uses Meteor 1.6.1 which uses node 8.9.4
build your production app using the build command (I adapted your specs a bit here).
$ cd ~/path/to/meteor-project
$ meteor npm install --production
$ meteor build ../build/deployment-test --server-only --architecture os.linux.x86_32
2. Prepare your target device' environment
Meteor builds are also Node.js applications. Your device will require an ARMv7 build of Node.js. The easiest way to do that is to use the install script from nodesource (open in new tab to view the script).
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
Note, that official node installation guide also points out, that "To compile and install native addons from npm you may also need to install build tools". You will need this, because fibers or bcrypt are such native addons.
$ sudo apt-get install -y build-essential
Verify your installed node version
$ node -v
v8.11.4 # but we need v8.9.4
The easiest way to get the correct version of node, that exactly matches your development version, is to use the npm n package.
$ sudo npm install -g n
$ sudo n 8.9.4
$ # ... installs target version
$ node -v
v8.9.4 # if this is still the old version just restart the shell
if you need help on this, read this github issue thread
finally install mongodb >= 2.6 (important!) on your target device (not covered in this answer).
3. Install your production app on the target device
copy / move / upload your build archive to your target device
extract your deployment bundle
$ cd ~/path/to/deploymentapp
$ tar -xvzf ./meteor-project.tar.gz # extracts all content into a folder named 'bundle'
install npm dependencies on target system
$ cd bundle/programs/server/
$ npm install --production
if you have replicated all the above steps the npm packages (and espeically the native packages, such as fibers or bcrypt) should be installed here without any errors. Now go back to bundle/ and start the app:
$ cd ../../
$ MONGO_URL=mongodb://yourmongodbcredentials node main.js
I hope by replicating this guide you will find a solution to your problem.
Added for SEO reasons: This guide shows how to deploy a Meteor app on a Raspberry PI with ARMv7 architecture and Raspbian (32 bit) installed. It can also be used as a foundation for other ARMv7 devices, such as OP's Synology.
I've had this problem where, from a brand new installation of Node and npm, the serial port package won't load with the following error in the Hello World Electron package:
I am on Node version 6.6.0 and NPM version 3.10.7 and OS X 10.11.6.
I looked to see if I was somehow out of date, but looking at this list, I can't find anything that has a module version of 50. Is this a bug?
I have tried npm rebuild, as well as removing modules and reinstalling, but no dice.
Update: even though when I run node -v it prints v6.6.0, running process.versions.node in the web console gives me v6.5.0. What's going on here?
This is a known issue which is caused by the serialport module using native code that is built for a different version of Node. You can read a bit more about addons here, if you're interested; they're just modules written in C/C++ that can interface with Node so the module can interface with the hardware more easily.
The solution proposed by that issue is this:
npm rebuild --runtime=electron --target=1.2.5 --disturl=https://atom.io/download/atom-shell --build-from-source
If you've not already installed electron-rebuild, that might be helpful to ensure that the rebuilding process works correctly:
npm install --save-dev electron-rebuild
even though when I run node -v it prints v6.6.0, running process.versions.node in the web console gives me v6.5.0. What's going on here?
Electron uses its own version of Node that isn't connected to your system Node installation (see the homepage to view the Node version that the latest Electron uses, or use process.versions.node, like you did in the question).
You could try an older version (perhaps 1.1.0, which uses Chrome 50?) in case that is the cause of the issue.
In my case the error was:
App threw an error during load
Error: Module version mismatch. Expected 50, got 48.
at Error (native)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:583:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/myapp/node_modules/sqlite3/lib/sqlite3.js:4:15)
After rebuilding error was fixed:
npm install --save-dev electron-rebuild
npm rebuild --runtime=electron --target=1.4.3 --disturl=https://atom.io/download/atom-shell --build-from-source