10

I have this bit of react code called main.js:

var React = require('react');

var Comment = React.createClass({
render: function(){
  return (
    <div className="comment">
      <h2 className="commentAuthor">
        {this.props.author}
      </h2>
      <span dangerouslySetInnerHTML={{__html:marked(this.props.children.toString(), {sanitize:true})}} />
    </div>
  );
}
});

And I am trying to use browserify and reactify with it:

browserify -t reactify main.js

But I am getting this error:

Error: Cannot find module 'react' from '/Users/jameslin/projects/reactjs/react-0.13.2'
    at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
    at process (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
    at ondir (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
    at load (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at Object.oncomplete (fs.js:107:15)

Given that I have installed react and reactify npm modules by:

  • npm install -g react
  • npm install -g reactify

1 Answer 1

14

The moment I posted my question, and seems I found the answer, installed the module locally fixed it.

npm install react

But then I get another error:

Error: EMFILE, open '/Users/jameslin/node_modules/react/package.json'

UPDATE:

running ulimit -n 10000 fixed the issue

Sign up to request clarification or add additional context in comments.

1 Comment

But why? (morecharacterstopost)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.