question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Powered By Google not being imported - Require Cannot find module

See original GitHub issue

Hello, I get this error since lastest release 5.4.0, please help !

Uncaught Error: Cannot find module 'react-places-autocomplete/images/powered_by_google_default.png' from 'react-places-autocomplete/dist/PlacesAutocomplete.js'

Line 372 of /node_modules/react-places-autocomplete/dist/PlacesAutocomplete.js is generating the error. this.props.googleLogo && _react2.default.createElement( 'div', { id: 'PlacesAutocomplete__google-logo', style: this.inlineStyleFor('googleLogoContainer'), className: this.classNameFor('googleLogoContainer') }, _react2.default.createElement('img', { src: require('./images/powered_by_google_' + this.props.googleLogoType + '.png'), style: this.inlineStyleFor('googleLogoImage'), className: this.classNameFor('googleLogoImage') }) )

When using hard coded path of copy of the image from my assets/images folder works perfectly. E.g. src: “http://localhost:4000/images/powered_by_google_default.png

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
jacobimpsoncommented, Dec 8, 2017

Expanding on @Floriferous 's solution, this is a quick workaround that I am using until something more permanent is implemented into the package.

const myStyles = {
    autocompleteContainer: {
        paddingBottom: '20px',
        backgroundSize: 'auto 12px',
        backgroundPosition: 'bottom left 10px',
        backgroundRepeat: 'no-repeat',
        backgroundImage: "url('https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png')",
    },
};
<PlacesAutocomplete
    styles={myStyles}
    googleLogo={false}
/>

You lose some semantics this way (by not having an inline image) but seems like a decent work around in the short time that could come in handy for some.

3reactions
hibikencommented, Sep 26, 2017

Would it make sense to remove Google Image from the library and add an optional footer prop so that user of the library can provide their custom footer element for the dropdown? Feedback would be appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error "Cannot find module" when using import with ...
1 Answer 1 · Hi, thanks for anwser, but my question was how to use extension-less import with import/export, not require/module.exports. – ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
When you get the “cannot find module” error, or “module not found”, it means you've not installed the package you're trying to use....
Read more >
Cannot find module "@types/google-maps" in --prod builds
i have an app which uses google maps. I added the type definitions via npm install @types/google-maps --save This works for development ...
Read more >
Guild run can't find module/relative import - Troubleshooting
My code is calling a git command at execution. But guild is running the code from another (temporary) folder, which is not a...
Read more >
Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found