Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

401
Visualizações
A dynamic link library (DLL) initialization routine failed | nw.js error connecting canvas

I use nw.js and when trying to connect the canvas module (node-canvas), this error appears. Installing a different version of node/canvas didn't help. The error appears when require('canvas') Error image: Error

Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\N:\BOTSer\Protocol\node_modules\canvas\build\Release\canvas.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1224:18)
    at Module.load (node:internal/modules/cjs/loader:999:32)
    at Function.Module._load (node:internal/modules/cjs/loader:846:12)
    at Module.require (node:internal/modules/cjs/loader:1023:19)
    at require (node:internal/modules/cjs/helpers:97:18)
    at Object.<anonymous> (N:\BOTSer\Protocol\node_modules\canvas\lib\bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1121:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1179:10)
    at Module.load (node:internal/modules/cjs/loader:999:32)
    at Function.Module._load (node:internal/modules/cjs/loader:846:12)
    ```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

That module requires a native build that is compatible with your global install of Node.js. If the version of Node in NW.js doesn't match your global install, then the built binary will not work with it. Things always work better when you switch your global Node.js install version to match what is built into NW.js. You can use nvm-windows or nvm to control your global Node version, just be sure to uninstall Node.js first before using a Node Version Manager so you don't have two conflicting global installs. You can check the Node.js version in NW.js by running console.log(process.version);.

  • https://github.com/nvm-sh/nvm (OSX/Linux)
  • https://github.com/coreybutler/nvm-windows (Windows 8+)
  • https://github.com/nullivex/nodist (Windows 7)
  • https://nwjs.io/versions.json (All NW.js versions data)

If my assumption is correct then:

  1. Open your app, right-click > inspect > console > process.version > write down the Node version you need > close your app.
  2. Delete node_modules and package-lock.json
  3. Uninstall Node.js globally
  4. Install the correct Node Version Manager for your OS
  5. Use the Node Version Manager to install the version your wrote down in step 1
  6. Do a fresh npm install in your project and try running it again

Though I'm very confused as to why you would be using the native canvas module with NW.js. Why are you packaging an entire browser with your application that has a canvas built in, and then pulling in a second tool and using it instead? Just use the browser's canvas.

  • https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda