question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled permission error leads to [Error: Pin has not been exported]

See original GitHub issue

I’m trying to setup/read using this library but i’m getting “Pin has not been exported” error, here is my code:

gpio.setup 23, gpio.DIR_IN, gpio.EDGE_BOTH, ( error, data ) ->

  gpio.read 23, ( error, data ) ->

    if error then return console.log 'error reading', error

    console.log data

here is the error:

error reading [Error: Pin has not been exported]

if i manually export and try to read via gpio it works //=

echo 23 > /sys/class/gpio/export
gpio read 23
0
gpio read 23
1

rPi 2, model B

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JamesBarwellcommented, Aug 30, 2016

Thanks for the report and for the solution.

I think there are two issues here:

  1. the README examples are not very good as they don’t catch the errors on pin setup, and people are following their bad example.
  2. the API is perhaps a bit too granular for how people want to use the module. Setting up and writing to a pin must be the most common use-case, yet it requires two method calls and error handling at each level. Perhaps there should be a simpler API that combines the step and provides a single place where error-handling is required.
0reactions
PiyushRamukacommented, Apr 20, 2017

@JamesBarwell - created one. Thanks! Issue 59

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pin has not been exported for write - Raspberry Pi Forums
The error I'm getting is: Code: Select all. Error: Pin has not been exported for write at ...
Read more >
Unhandled rejection Error: EACCES: permission denied
This happens if the first time you run NPM it's with sudo, for example when trying to do an npm install -g. The...
Read more >
Using GPIOs without Using sudo - Google Groups
Apparently exporting twice to the same pin will cause it to go away. If I understand the issue correctly. All the more reason...
Read more >
Exchange Server error in '/owa' application
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the ...
Read more >
Error Codes and Descriptions - Travelport
Requested Universal Locator Code is not associated with requested PNR. 6231, Unhandled Resource Type: $?. 6232, Yet to be implemented. 6233, Universal Locator ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found