简体   繁体   中英

how can i edit ip address of raspberryPi in javascript?

i want change ip address, subnet mask and gateway of Pi3 in node js.

i used module ' network-config ' and wrote and executed the code below.

var networkconfig = require('network-config');

networkconfig.configure('eth0',{

ip:         192.168.1.111,
netmask:    255.255.255.0,
gateway:    192.168.1.1,

},function(err){
    console.log(err);
});

but an error has occurred.

{Error: EACCES: permisiion denied, open '/etc/network/interfaces'
error:-13,
code:'EACCES',
syscall:'open',
path:'/etc/network/interfaces'}

I do not seem to have access, how do I get permission?

Or is there another way edit Pi's IP?

用sudo“ sudo node file.js”执行nodeJS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM