I'm getting a Node module version mismatch in a fu...
# prisma-whats-new
l
I'm getting a Node module version mismatch in a function:
Copy code
Error: Module version mismatch. Expected 48, got 57.\n    at Error (native)\n    at Object.Module._extensions..node (module.js:597:18)
I'm requiring a module that I never required before, bcrypt
I imagine bcrypt has some native code
I imagine it might have something to do with the fact that I'm running Node 8 on my machine and the function runtime is probably 6...I'm really hoping I won't have to compile my functions with Node 6 locally. Perhaps graphcool should do an npm rebuild on the target platform when functions are deployed
I imagine what's happening is that graph.cool is pushing the node_modules folder as-is...that's not good for any modules that have native code that needs to be compiled
a
If you have modules that use native code (like bcrypt) and you are not running on Linux, you have to build them using Docker.
l
I'm running on Linux
a
I think the gyp part is only influenced by platform, not by node version
l
Okay, I'll play around
a
Otherwise, look at https://github.com/graphcool/serverless-image-proxy for an easy build strategy with a node 6 docker
l
I'm using Ubuntu 14, and I'm using Node 8 on my local machine. I do a graphcool deploy and I get the module version mismatch error. I then installed Node 6 on my local machine, did a fresh npm install, and did a graphcool deploy, and everything works
Which is problematic, it shouldn't matter what version of Node I'm running ideally
Within reason of course, but 6 versus 8
a
That's where the build strategy with the Docker machine comes in.
l
Is that the final solution graph.cool would go with?
If there is an environment that the functions need to run in, the cli should be implementing the docker solution and ensuring Node versions are identical, for a good developer experience
Is my suggestion
a
That's their idea at the moment, that the CLI would do the build in the Docker
👍 1
l
Is there a GitHub issue that you know of for that?
a
Well, I created the exact opposite issue, so indirectly, there is one 😄 https://github.com/graphcool/graphcool/issues/795
👍 1