Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running example usage #18

Open
PnsDev opened this issue Jun 30, 2021 · 1 comment
Open

Error when running example usage #18

PnsDev opened this issue Jun 30, 2021 · 1 comment

Comments

@PnsDev
Copy link

PnsDev commented Jun 30, 2021

What's going wrong

When I run sudo node test this error pops out

node:internal/modules/cjs/loader:1154
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/home/pi/codingStuff/leds/node_modules/rpi-ws281x/build/Release/rpi-ws281x.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. 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:1154:18)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/pi/codingStuff/leds/node_modules/rpi-ws281x/index.js:2:13)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Test.js Contents

var ws281x = require('rpi-ws281x');

// One time initialization
ws281x.configure({leds:16});

// Create my pixels
var pixels = new Uint32Array(16);

// Render pixels to the Neopixel strip
ws281x.render(pixels);

Info

uname 5.10.17-v7+ GNU/Linux
NodeJS Ver 14.6.0

@arronsmith
Copy link

Did you install node with nvm? That caused problems for me because the build tools end up pointing at the wrong things.

This fixed it for me but ymmv:

  1. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash //don't do this if nvm is already installed
  2. Restart terminal so that nvm is in the path.
  3. nvm install v12.22.3
  4. sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
  5. sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants