Getting Error EBUSY: resource busy or locked

前端 未结 7 1484
南笙
南笙 2021-02-15 15:41

Trying to run a Nodejs app to test Raspberry 3 B + Gpio Onoff Module but when i am trying to run the app getting this Error

fs.js:114
throw err;

Error: EBUSY: r         


        
相关标签:
7条回答
  • 2021-02-15 15:56
    var onoff = require('onoff');
    var Gpio = onoff.Gpio,
        led = new Gpio(4, 'out'),
        interval;
    interval = setInterval(function () {
        var value = (led.readSync() + 1) % 2;
        led.write(value, function () {
            console.log("Changed LED state to: " + value);
        });
    }, 2000);
    process.on('SIGINT', function () {
        clearInterval(interval);
        led.writeSync(0);
        led.unexport();
        console.log('Bye, bye!');
        process.exit();
    });
    
    0 讨论(0)
  • 2021-02-15 16:04

    Find the packager-info.json file inside the .expo folder and delete it. Now restart it by expo start command.

    0 讨论(0)
  • 2021-02-15 16:06

    I know this is barley advice since its so obvious but I spent over an hour on this then restarted my computer, problem fixed!

    just a reminder the most obvious solutions are sometimes the right solutions.

    All the other solutions posted about this problem didnt work for me. Maybe because my problem was a log file was being locked which prevented me from using npm at all. The log file didn't even show up in the directory it was supposed to be in.

    0 讨论(0)
  • 2021-02-15 16:09

    There are many answers on GitHub regarding this issue.

    • Some says npm cache clean this command executing on terminal solved the problem.

    • Others recommend to delete the entire directory your app is the folder in and re-install the packages and then try running the program.

    • Some also says that It is caused by the anti-malware software and recommend to disable it while running the program.

    GitHub issue link: https://github.com/npm/npm/issues/13461

    If it doesn't solve the issue, just change the GPIO pin to let's say 23 in coding and don't forget to physically replace LED from 4 to 23 too.

    0 讨论(0)
  • 2021-02-15 16:11

    If you are on windows.

    Try running your bash window as Administrator.

    For example, in my case, I was using git bash.

    Search on windows "Gitbash" (or any other command-line window) -> Right-click -> Run as Administrator. Worked for me.

    0 讨论(0)
  • 2021-02-15 16:13

    Some says npm cache clean this command is not properly work.

    we try uninstall nodejs and reinstall nodejs

    after properly work

    0 讨论(0)
提交回复
热议问题