简体   繁体   中英

node.js: “TypeError: _ref is undefined” error on windows but runs ok on linux

I'm trying to install and run a node app on windows that is running ok on linux. It seems to install ok but when I call npm start I get the following error:

TypeError: _ref is undefined
RangeInput/_this.handleSlider
e:/temp/pp/reactsearch/node_modules/@appbaseio/reactivesearch/lib/components/range/RangeInput.js:143

  140 | };
  141 | 
  142 | _this.handleSlider = function (_ref) {
> 143 |   var start = _ref.start,
      | ^  144 |       end = _ref.end;
  145 | 
  146 |   _this.setState({

I'm new to node. Can anyone suggest where to start to figure out what I've done wrong? I followed the same install process I used to install and run the app on linux.

Thanks, Phil

So sometimes this error pops up in React/Node apps you build when you're calling or referencing something too early.

I don't know your whole code but what it looks like is React isn't reading on time the argument you passed into your function so when you call the .start property, it can't read what that property is because it's not referencing anything.

Try instantiating a value for the variable when the component mounts or using promises to make sure that your function argument is defined before the code after it runs. Or if those methods don't fit your code, the bottom line is to make sure that your argument is being passed into the function first. Otherwise, it'll error out.

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