javascript - Module not found: Can't resolve 'google-maps-react' in 'C:\Users\USUARIO - TagMerge
4Module not found: Can't resolve 'google-maps-react' in 'C:\Users\USUARIOModule not found: Can't resolve 'google-maps-react' in 'C:\Users\USUARIO

Module not found: Can't resolve 'google-maps-react' in 'C:\Users\USUARIO

Asked 1 years ago
3
4 answers

Based off the tutorial it looks like you've missed a crucial step.

You need to install google-maps-react dependency in your project.

In your console, navigate to your project root directory and run the following:

npm install --save google-maps-react

Another troubleshooting issue for those who are stuck is to DELETE your node_modules folder and the run npm install in the console.

This will reinstall all the required dependencies for your project.


Note:

Considering you've accidentally installed google-map-react instead of google-maps-react. I recommend uninstalling google-map-react since it's not being used.

Do that by run the following in your console:

npm uninstall --save google-map-react

Source: link

0

I had the same issue. I fixed it by adding declare module 'google-map-react'; in file react-app-env.d.ts

Try it out and give a feedback by the way I am using TS with React

Source: link

0

File Structure
webpack.config.js
app
-- index.js
-- test.js
webpack.config.js
module.exports = {
    devtool: "cheap-module-source-map",
    entry: "./app/index.js",
    output: {
        filename: "public/bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel-loader',
                query:
                {
                    presets: ['es2015']
                }
            }
        ]
    }
};
test.js
export default function test(message) {
    console.log(message);
}
index.js
"use strict"

import test from './app/test.js';
When attempting to run the webpack command I get the error:
ERROR in ./app/index.js

Module not found: Error: Can't resolve './app/test.js'

Source: link

0

import File1b from './File1b'
Wrong way – Absolute path
import File1b from './Folder1/SubFolder1/File1b'
Correct way –
import File1 from '../File1'
import File1 from './Folder1/File1'
But if you are a fan of absolute paths, then there is a way. In your jsconfig.json or tsconfig.json files, add this –
{
  "compilerOptions": {
    "baseUrl": "."
  }
}

Source: link

Recent Questions on javascript

    Programming Languages