Error: EACCES: permission denied, open '/Users/yuping.hu/.xtoolkit/config.json'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.writeFileSync (fs.js:1299:33)
at Object.exports.save (/usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/src/util/config.js:43:6)
at done (/usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/src/hook/post_install.js:23:14)
at ChildProcess.onEnd (/usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/src/util/ping.js:95:5)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/src/util/ping.js:81:36)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
是因为没有权限照成的,官方给出了解决办法
它的意思是:
先执行
sudo chmod 777 /usr/local/lib/node_modules
然后在执行
npm install -g weex-toolkit
(这里注意千万不要加上sudo,不然还是会报错)