Windows 10, Electron app used to work great, using node-canvas lib. Today, at long last updated:
npm -> 2.15.9
node -> 4.5.0
electron-prebuilt -> 1.4.1
then followed instructions to update and rebuild the canvas lib. All dependencies updated, installed canvas#1.5.0 and node-gyp rebuild ran smoothly and successfully
But - running npm start to run the app fails with the following trace:
App threw an error during load
Error: A dynamic link library (DLL) initialization routine failed.
\\?\D:\GoMixApp\web\electron\GoMixApp\node_modules\canvas\build\Release\canvas.node
at Error (native)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:168:20)
at Object.Module._extensions..node (module.js:583:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:168: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> (D:\GoMixApp\web\electron\GoMixApp\node_modules\canvas\lib\bindings.js:3:18)
Going back and forth for last few hours, I always end up with the same error. Am I doing something stupid?
Thanks
After installing the module, you need to run electron-rebuild
npm install -g electron-rebuild
electron-rebuild -f -w canvas
Related
When I am doing npm install in the project that I clone from github & then npm start I am getting error:
/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252
var file = callSite.getFileName() || '<anonymous>'
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252:23)
at depd (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:111:14)
at Object.<anonymous> (/Users/abc/Documents/Projects/test-project/node_modules/body-parser/index.js:14:32)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Module._compile (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:136:24)
at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Object.newLoader [as .js] (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:141:7)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
This 'depd' library is throwing error from all the occurrences as it is a dependancy in various npm packages like body-parser & express. So it is throwing error from within all of them.
However my existing setup from same github repo where I am not doing npm install from scratch seem to be working fine.
I have tried doing npm install with different nodeJs versions 6.9.5, 10.x.x, 11.x.x, 12.x.x
Also I am using Babel v7.
Upgrade Node.js to the latest LTS. I was on 12.x and had this error, so upgrading to 16.x fixed it.
node:internal/modules/cjs/loader:1161 return process.dlopen(module,
path.toNamespacedPath(filename));
^
Error: The module '\?\G:\Discord
bot\Bot\ZackyBot\node_modules\canvas\build\Release\canvas.node' was
compiled against a different Node.js version using NODE_MODULE_VERSION
83. This version of Node.js requires NODE_MODULE_VERSION 88. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object. (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object. (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\canvas.js:9:18)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32) { code: 'ERR_DLOPEN_FAILED' }
It seems like you installed a newer version of NodeJS than earlier. But you did not compile your project ZackyBot's node modules using the current version of the NodeJS you installed.
I would suggest you go to your project directory and clean all your node modules. Then reinstall them again. Follow the steps below:
Delete node_modules directory inside ZackyBot directory
Execute npm install command on a terminal from ZackyBot directory
Since you updated your nodeJS version to a newer one, you need to update your canvas too.
run npm install canvas and you should be good to go.
This might be due to improper installation of node modules and can occur due to poor network conditions.
Solved this issue by deleting the nodemodules folder and doing a clean installation of node modules files by running "npm install".
I'm developing an electron app and after several atempts I got stucked in this. The browser inspector returns the below error when loading serialport.
Uncaught Error: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).
\\?\C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\serialport\build\Release\serialport.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
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 bindings (C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\bindings\bindings.js:81:44)
at Object.<anonymous> (C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\serialport\lib\bindings\win32.js:2:36)
In order to use it, I've built it from source using:
npm install --global --production windows-build-tools
Since this wasn't enough, installed manually
https://www.microsoft.com/en-us/download/confirmation.aspx?id=40760
And lately:
npm config set msvs_version 2015
npm install --save --build-from-source serialport
This allows me to build serialport. However I'm still not able to use it.
I was able to run it using:
npm install --save-dev electron-rebuild
Adding this to package.json
"scripts": {
"rebuild": "electron-rebuild -f -w yourmodule"
}
And running
npm run rebuild
I am attempting to use the npm package "create-react-app" to get started on a react project using WebStorm.
I have run npm install -g create-react-app to install the package globally, and can use the package perfectly fine with from the command line (i.e. create-react-app <proj name>).
However when creating a project in WebStorm and using the path to the global "create-react-app" package (found using npm list -g), I encounter this error:
/usr/bin/node /usr/local/lib/node_modules/create-react-app/index.js .
/usr/local/lib/node_modules/create-react-app/createReactApp.js:589
.filter(file => !validFiles.includes(file));
^
TypeError: validFiles.includes is not a function
at /usr/local/lib/node_modules/create-react-
app/createReactApp.js:589:33
at Array.filter (native)
at isSafeToCreateProjectIn (/usr/local/lib/node_modules/create-
react-app/createReactApp.js:589:6)
at createApp (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:147:8)
at Object.<anonymous> (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:134:1)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
Done
Have I gone wrong at some point?
It turns out I had node version 4, and create-react-app requires version >= 6 - although this warning was not displayed via the WebStorm "Run" panel.
Thus I fixed this issue by updating to node v6.11.3, using nvm.
I'm trying to install node-expat. I've tried everything suggested that I could find. I don't get any build errors while running npm install node-expat. I've put in all the dependencies & building kits, tried npm cache clean & tried it on both CentOS (Amazon Linux) and Ubuntu 12.10 but the error remains the same:
module.js:485
process.dlopen(filename, module.exports);
^
Error: Module version mismatch, refusing to load.
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/ubuntu/cc/node_modules/node-expat/lib/node-expat.js:4:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
How can I get it to run without hitches?
The reason I want node-expat is for node-xmpp
This may or may not help you, but I was getting the same error with an appjs app I'm working on, and I just figured out what was causing it for me. I have node v0.10.x installed on my machine, but I was building the modules to include them in an appjs app (which currently comes packaged with v0.8.x of node.exe. So I was building the module with 0.10, but trying to run it on 0.8.
I uninstalled my node 0.10, installed 0.8, rebuilt/installed the offending module into my appjs app, and the error went away. So make sure you're building the module with the same version of node you're trying to run it on!