I am trying to create a simple example Native addon for Electron. However, keep running into this version miss match issue. I have .nvmrc files for both my electron project and the addon project (using node 7.4.0).
Electron 1.6.7
Node 7.4.0
Nvm 0.33.2
NPM 4.0.5
The Error
App threw an error during load
Error: The module '/Users/mikepriest/source/Browser/exambrowser-electron/app/native/prebuilt/addon/build/Release/native_rt.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/mikepriest/source/Browser/exambrowser-electron/app/main.dev.js:20:10)
at Object.<anonymous> (/Users/mikepriest/source/Browser/exambrowser-electron/app/main.dev.js:217:3)
Tried solutions
1. Tried using
./node_modules/.bin/electron-rebuild
2. Tried rebuilding my addon
nvm use 7.4.0
npm rebuild
Still get the error.
Update: found this post, but solution didn't work for me either.
Related
I know this question is posted many times but I tried the solutions and I can not resolve it. I am trying to work wit npm however I get this error:
evalmachine.<anonymous>:35
} = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:35:5
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:8)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
I can not even execute npm -v to see the version.
I tried to downgrade node to version 10.
I tried to uninstall-reinstall node so many times (From remove application settings).
I tried to create a file called "npm-shrinkwrap.json" insde the npm folder where package.json exists.
But there is no use.
And I can't see an "AppData" folder in the "Users/User" path but I can access it by "cd" from the command line. I don't understand how it is not visible.
Thank you.
It is resolved!
I know I said I uninstalled npm, but just uninstalling it from the settings were not enough. I tried to uninstall it deleting the node releted directories on my computer following this post: https://stackoverflow.com/a/11178106/13806114. And then I installed node again and it worked!
Thank you.
It's looking for the "primordials" method in graceful-fs, trying to reinstall this dependency.
About npm, try reinstalling nodejs again, probably your npm is corrupted
About AppData is not visible or is a hidden directory in Windows, you can access it by path in Windows Explorer
I'm getting this error message, After i installing CHILKAT with this command line in NodeJS(version v12.6.0):
npm rebuild #chilkat/ck-node11-win64
Waiting foError: The module
'\?\c:\APEX\Projets\PDF_SignElec\WS\Projets\node_modules#chilkat\ck-node11-win64\chilkat.node'
was compiled against a different
Node.js version using
NODE_MODULE_VERSION 67. This version
of Node.js requires
NODE_MODULE_VERSION 72. Please try
re-compiling or re-installing the
module (for instance, using npm
rebuild or npm install).
at Object.Module._extensions..node (internal/modules/cjs/loader.js:817:18)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object. (c:\APEX\Projets\PDF_SignElec\WS\Projets\myExample_5.js:17:19)
at Module._compile (internal/modules/cjs/loader.js:773:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
r the debugger to disconnect...
I forgot to post this update. The Chilkat lib for Node.js 12 is available at https://www.npmjs.com/package/#chilkat/ck-node12-win64
You need to rebuild the binary.
Try the following:
npm rebuild #chilkat/ck-node11-win64 --update-binary
Look here at the history of NODE_MODULE_VERSION numbers paired with Node.js version numbers: https://nodejs.org/de/download/releases/
NODE_MODULE_VERSION 67 is equivalent to Node.js 11.* The Chilkat module #chilkat\ck-node11-win64 is correctly built with NODE_MODULE_VERSION 67.
However, the version of Node.js you are currently using must not be Node.js 11, because the error message says "This version of Node.js requires NODE_MODULE_VERSION 72". You must be using Node.js 12.. Chilkat will be releasing for Node.js 12. this coming week.
I am facing the error invalid ELF header when I'm trying to run my node.js project on my printer having linux os using putty. The project was developed on windows. I'm attaching the whole error that I'm receiving. Please help.
stack=[Error: /sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/build/Release/binding.node: invalid ELF header,
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 bindings (/sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/node_modules/bindings/bindings.js:81:44),
at Object.<anonymous> (/sirius/rw/test/node-v8.11.1-linux-armv7l/node_modules/ref/lib/ref.js:5:47),
at Module._compile (module.js:652:30),
at Object.Module._extensions..js (module.js:663:10)]
Because the project was developed on windows; npm needs to compile some node modules specially for the linux OS, so simply using the modules as is won’t always work.
First remove the node modules:
rm -rf node_modules/
Then generate the same modules for linux using the following command:
npm update
I hope this helps
I am trying to get my own project written on OSX to build on Ubuntu. It uses several npm packages to build itself. A few of them depend on the npm package js-yaml, which in it's turn depends on a package called 'esprima'. A fresh Ubuntu 14.04 installation gives me the error that this package can not be found:
module.js:340
throw err;
^
Error: Cannot find module 'esprima'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/michahell/Documents/projects/pinbored-webkit/node_modules/grunt/node_modules/js-yaml/lib/js-yaml/type/js/function.js:4:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
The output tells me that it might have something to do with the legacy binary node, but i should have solved this problem by symlinking node to point to nodejs, using this S.O. post:
nodejs vs node on ubuntu 12.04
So, what is causing npm / node to not be able to find or install this package?
So i have apparently solved this by manually installing the missing node module:
npm install esprima
Apparently, the npm module requiring this esprima module could just find it if it was 'locally' npm installed. If this is intended / deterministic behaviour, that's nice to know :)
I am trying to run a sails application with Webstorm 7.0.3.
this appear when i try to run the server in the console log:
module.js:340
throw err;
^
Error: Cannot find module 'sails'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Users**\projects\WebstormProjects**\app.js:2:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain [as _onTimeout] (module.js:497:10)
Process finished with exit code 8
i installed sails globaly. i know that this is dont work because it cant find the sails module in the project's local 'node_modules' directory. if ill install again 'sails' localy it will work. but i dont want to...
Is there a way to make it work with sails global install? thanks!
The sails module that your code is looking for is not the same thing as the sails command you're executing at the terminal.
The command generates project skeletons. The module is the code that actually makes it run.
You need to install the command globally and the module locally.
Global installation (using npm install -g) does not make modules available globally to all node applications, it's only there for command line stuff.
If your applications relies on Sails, you should have it in your dependencies in package.json as well as installed locally.
If you don't like the way that npm creates a copy of each module locally, use yarn and tell it to symlink the cached version.