React_on_rails: Cannot find module "react"

Created on 7 Mar 2016  路  1Comment  路  Source: shakacode/react_on_rails

I want to use an npm module called react-select

The module includes the following:

var React = require('react');
var ReactDOM = require('react-dom');
var Input = require('react-input-autosize');
var classes = require('classnames');
var Value = require('./Value');
var SingleValue = require('./SingleValue');
var Option = require('./Option');

Then, react_on_rails crashes when I try import Select from 'react-select', complaining Uncaught Error: Cannot find module "react".

More logs:

20:46:05 client.1 | ERROR in ./~/react/react.js
20:46:05 client.1 | Module build failed: Error: Final loader didn't return a Buffer or String
20:43:16 client.1 | ERROR in ../~/react-select/lib/Select.js
20:43:16 client.1 | Module not found: Error: Cannot resolve module 'imports' in node_modules/react-select/lib
20:43:16 client.1 |  @ ../~/react-select/lib/Select.js 11:12-28
20:43:16 client.1 |
20:43:16 client.1 | ERROR in ../~/react-select/lib/Value.js
20:43:16 client.1 | Module not found: Error: Cannot resolve module 'imports' in node_modules/react-select/lib
20:43:16 client.1 |  @ ../~/react-select/lib/Value.js 3:12-28
20:43:16 client.1 |
20:43:16 client.1 | ERROR in ../~/react-select/lib/SingleValue.js
20:43:16 client.1 | Module not found: Error: Cannot resolve module 'imports' in node_modules/react-select/lib
20:43:16 client.1 |  @ ../~/react-select/lib/SingleValue.js 3:12-28
20:43:16 client.1 |
20:43:16 client.1 | ERROR in ../~/react-select/lib/Option.js
20:43:16 client.1 | Module not found: Error: Cannot resolve module 'imports' in node_modules/react-select/lib
20:43:16 client.1 |  @ ../~/react-select/lib/Option.js 3:12-28
20:43:16 client.1 |
20:43:16 client.1 | ERROR in ../~/react-select/~/react-input-autosize/lib/AutosizeInput.js
20:43:16 client.1 | Module not found: Error: Cannot resolve module 'imports' in node_modules/react-select/node_modules/react-input-autosize/lib
20:43:16 client.1 |  @ ../~/react-select/~/react-input-autosize/lib/AutosizeInput.js 5:12-28

On browser:
screen shot 2016-03-06 at 8 56 38 pm

>All comments

You probably have not properly installed React.

Was this page helpful?
0 / 5 - 0 ratings