Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: 'jsonp' #34

Open
Endogen opened this issue Apr 26, 2017 · 1 comment
Open

Module not found: 'jsonp' #34

Endogen opened this issue Apr 26, 2017 · 1 comment

Comments

@Endogen
Copy link

Endogen commented Apr 26, 2017

I'm trying to write a react app and i installed jasonp via npm install jasonp. My code

import React, {Component} from 'react';
import { AutoComplete }   from 'material-ui';
import getMuiTheme        from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider   from 'material-ui/styles/MuiThemeProvider';
import JSONP              from 'jsonp';

const googleAutoSuggestURL = `
  //suggestqueries.google.com/complete/search?client=youtube&ds=yt&q=`;

class MaterialUIAutoComplete extends Component {
  constructor(props) {
    super(props);
    this.onUpdateInput = this.onUpdateInput.bind(this);
    this.state = {
      dataSource : ['Test', 'Test2'],
      inputValue : ''
    }
  }

  onUpdateInput(inputValue) {
    const self = this;
    this.setState({
      inputValue: inputValue
    }, function() {
      self.performSearch();
    });
  }

  performSearch() {
    const
      self = this,
      url  = googleAutoSuggestURL + this.state.inputValue;

    if(this.state.inputValue !== '') {
      JSONP(url, function(error, data) {
        // handle results here
      });
    }
  }

  render() {
    return <MuiThemeProvider muiTheme={getMuiTheme()}>
      <AutoComplete
        dataSource    = {this.state.dataSource}
        onUpdateInput = {this.onUpdateInput} />
      </MuiThemeProvider>
  }
}

export default MaterialUIAutoComplete;

After executing it i get the error

Failed to compile.

Error in ./src/App.js
Module not found: 'jsonp' in /Users/dave/Programming/Web/cenote/src

 @ ./src/App.js 24:13-29

It is installed in cenote/node_modules/jasonp. Any idea why i get this error?

@vpzomtrrfrt
Copy link

jasonp is a different module: https://www.npmjs.com/package/jasonp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants