我有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 Home Automation Server。我希望这可以帮助像我一样的所有新手在Raspberry Pi上进行家庭自动化。
我发现了两个步骤:
const homeConfig =
require('../home-config');
向const homeConfig = require('home-config');
添加“../”但由于没有覆盆子pi环境而无法运行。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目录”。