2017-04-07 1139 views
0

React, React Hardware ([https://github.com/iamdustan/react-hardware/]) 및 Johnny-Five를 Particle Photon과 함께 사용하고 있습니다. 이 오류 스택은 아래 내 lib 디렉토리/app.js 파일을 실행할 때 온다 :C-Lang 검사가 React-Hardware/Particle에서 실패했습니다.

# Fatal error in ../deps/v8/src/api.cc, line 1062 
# Check failed: !value_obj->IsJSReceiver() || value_obj->IsTemplateInfo(). 
# 

==== C stack trace =============================== 

    0 node        0x00000001008c5ecd v8::base::debug::StackTrace::StackTrace() + 19 
    1 node        0x00000001008c4be5 V8_Fatal + 233 
    2 node        0x0000000100146438 v8::Template::SetAccessorProperty(v8::Local<v8::Name>, v8::Local<v8::FunctionTem 
plate>, v8::Local<v8::FunctionTemplate>, v8::PropertyAttribute, v8::AccessControl) + 0 
    3 serialport.node      0x00000001044ab098 SerialportPoller::Init(v8::Local<v8::Object>) + 248 
    4 serialport.node      0x00000001044a98ed init + 1201 
    5 node        0x00000001007c681a node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) + 860 
    6 node        0x000000010016a808 v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo< 
v8::Value> const&)) + 340 
    7 node        0x00000001001b1fdf v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespa 
ce)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::Heap 
Object>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) 
+ 915 
    8 node        0x00000001001b15b9 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::int 
ernal::Isolate*) + 281 
    9 ???         0x00000a3cdd6043a7 0x0 + 11256528389031 
    10 ???         0x00000a3cdd80a246 0x0 + 11256530510406 
[1] 69327 illegal hardware instruction node lib/app.js 

그것의 하드웨어가 작동하도록되어 어떻게 알 수 없기 때문에 수수께끼 조금.

import React, {Component} from 'react'; 
import ReactHardware from 'react-hardware'; 

import five from 'johnny-five'; 
import Particle from 'particle-io'; 

class BlinkingLed extends Component { 
    componentDidMount() { 
    this.node = new five.Led(this.props.port); 
    this.node.blink(this.props.period); 
    } 

    componentWillReceiveProps(nextProps) { 
    if (this.props.period !== nextProps.period) { 
     this.node.blink(nextProps.period); 
    } 
    } 


    render() { 
    return null; 
    } 
} 

BlinkingLed.defaultProps = { 
    port: 13, 
    period: 500, 
    }; 

ReactHardware.render(
    <BlinkingLed port={11} period={500} />, 
    new five.Board({ 
     io: new Particle({ 
     token: process.env.PARTICLE_TOKEN, 
     deviceId: process.env.PARTICLE_DEVICE_ID 
    }) 
    }), 
    (inst) => { 
    console.log('Rendered <%s />', BlinkingLed.name); 
    } 
); 

가 여기 내 package.json 아래입니다 :

은 여기 내 SRC/app.js입니다. 내가 브런치, 바벨을 사용하고 있습니다 및 JSX과 반응하십시오 :

{ 
    "name": "react-particle", 
    "version": "1.0.0", 
    "description": "", 
    "main": "index.js", 
    "scripts": { 
    "build": "babel src -d lib" 
    }, 
    "keywords": [], 
    "author": "", 
    "license": "ISC", 
    "dependencies": { 
    "johnny-five": "^0.10.7", 
    "particle-io": "^0.14.0", 
    "react": "15.0.0-rc.1", 
    "react-hardware": "^0.5.0-alpha.2" 
    }, 
    "devDependencies": { 
    "babel-cli": "^6.24.1", 
    "babel-preset-env": "^1.3.2", 
    "babel-preset-react": "^6.24.1" 
    } 
} 
+0

Johnny-Five에서 Particle-IO를 사용할 때 node-serialport가 보드와의 통신에 사용되지 않는 이유는 확실하지 않지만 오류는 node-serialport에서 발생합니다. React Hardware가 남아 있고 그 프로젝트의 소스 코드 나 실행 의미에 익숙하지 않습니다. 그 레이어를 추가하는 것이 왜 필요한지 잘 모르겠습니다. 이점이나 유용성을 제공하는 것으로 보이지 않습니다. – Rick

답변

0

범인은 react-hardware했다. 오류 메시지 발생을 격리 할 수있었습니다. 오류는 react-hardware이 필요할 때만 발생합니다.