facebookarchive / react-page

Easy Application Development with React JavaScript
Apache License 2.0
797 stars 72 forks source link

Requires node 0.10 #1

Closed stevoland closed 11 years ago

stevoland commented 11 years ago

Got an error with node 0.8.

package.info should include something like:

"engine": "node >= 0.10"
zpao commented 11 years ago

Thanks for the heads up!

jordwalke commented 11 years ago

Thanks guys - @stevoland: Was the error related to esprima? I've suspected that that error I've seen occasionally was related to my outdated node version - when I updated node, the error went away.

Thanks @zpao!

stevoland commented 11 years ago

@jordwalke: Don't think so. This was the error with node 0.8.16:

/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/docblock.js:24
  var match = contents.match(docblockRe);
                       ^
TypeError: Object /**
 * Copyright 2013 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @jsx React.DOM
 */

var Banner = require('../components/elements/Banner');
var React = require('React');
var SiteBoilerPlate = require('../components/core/SiteBoilerPlate.js');
var VectorWidget = require('../components/elements/VectorWidget.js');

var index = React.createClass({
  render: function() {
    return (
      <SiteBoilerPlate>
        <Banner bannerMessage="Welcome to React"/>
        <VectorWidget />
      </SiteBoilerPlate>
    );
  }
});

module.exports = index;
 has no method 'match'
    at Object.extract (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/docblock.js:24:24)
    at getDocblock (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/utils.js:319:39)
    at Function.visitReactTag.test (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/transforms/react.js:184:13)
    at walker (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/transform.js:87:21)
    at traverse (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/transform.js:63:7)
    at runPass (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/transform.js:109:3)
    at transform (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/node_modules/react-tools/vendor/fbtransform/lib/transform.js:124:15)
    at transformModuleImpl (/Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/src/Packager.js:136:25)
    at /Volumes/Data/Users/stevo/git/react-page/node_modules/react-page-middleware/src/Packager.js:162:29
    at fs.readFile (fs.js:176:14)
josdejong commented 10 years ago

I just got this exact same error message has no method 'match' when using react-tools to transform .jsx templates.

The issue here was that I loaded a template like reactTools.transform(fs.readFileSync('./myfile.jsx')), problem is that readFileSync returns a Buffer instead of a string, so you have to convert to string first, or you have to specify encoding in options so that readFileSync returns a string immediately.