React Native - 来自deepsyx的家庭自动化,如何运行它?

问题描述 投票:0回答:1

我有ReactJS的经验,我已经建立了web应用程序。但我从deepsyx https://github.com/deepsyx/home-automation看过家庭自动化

我试图在“服务器”目录中运行服务器,但它是错误的

me:server mai$ node index.js
internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'home-config'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/mai/Documents/Workspace/home-automation/server/index.js:13:20)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

如何解决这个错误?

这个项目非常酷,任何人都有运行这个项目的步骤?

提前致谢 !!!!

me:server mai$ cat package.json 
{
  "name": "home-automation",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Viktor Kirilov ([email protected])",
  "license": "MIT",
  "dependencies": {
    "home-config": "file:../home-config",
    "home-records": "file:../home-records",
    "ws": "1.1.1"
  }
}
react-native automation
1个回答
0
投票

我已经有了它来运行React Home Automation Server。我希望这可以帮助像我一样的所有新手在Raspberry Pi上进行家庭自动化。

我发现了两个步骤:

  1. 我发现它无法找到“home-config”目录的问题所以我转到“home-config”目录并将“index.example.js”复制到“index.js”。 在虚拟框中需要从const homeConfig = require('../home-config');const homeConfig = require('home-config');添加“../”但由于没有覆盆子pi环境而无法运行。
  2. 我从运行温度传感器“DS18B20”得到错误,然后我将const deviceFolder = files.find(file => /^10/.test(file));修复为“server / utils / temperature.js”中的const deviceFolder = files.find(file => /^28/.test(file));,因为我的raspberry pi 3生成了“28-01131faf1feb目录”。
© www.soinside.com 2019 - 2024. All rights reserved.