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 thrown with Node.js 14 #170

Closed
fivdi opened this issue Apr 23, 2020 · 2 comments
Closed

Error thrown with Node.js 14 #170

fivdi opened this issue Apr 23, 2020 · 2 comments
Labels

Comments

@fivdi
Copy link
Owner

fivdi commented Apr 23, 2020

With Node.js 14 invoking exportGpio results in an error being thrown here. This happens because fs.writeFileSync no longer accepts a number as data.

pi@raspberrypi:~/junk/node_modules/onoff/examples $ node blink-led.js 
internal/fs/utils.js:656
    throw new ERR_INVALID_ARG_TYPE(
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (17)
    at Object.writeFileSync (fs.js:1380:5)
    at exportGpio (/home/pi/junk/node_modules/onoff/onoff.js:18:8)
    at new Gpio (/home/pi/junk/node_modules/onoff/onoff.js:172:36)
    at Object.<anonymous> (/home/pi/junk/node_modules/onoff/examples/blink-led.js:4:13)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}
@fivdi fivdi added the bug label Apr 23, 2020
@fivdi
Copy link
Owner Author

fivdi commented Apr 23, 2020

Fixed by bf93550

@fivdi fivdi closed this as completed Apr 23, 2020
@fivdi
Copy link
Owner Author

fivdi commented Apr 25, 2020

The fix for this issue is available in onoff@6.0.0

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

No branches or pull requests

1 participant