After installing the google-map-react library locally in my app, I verified that it is listed in my package.json
under dependencies
. The corresponding folder also exists in the node_modules
directory. However, when attempting to reference the component constructor in a file with this line of code:
import GoogleMapReact from "google-map-react";
I encountered errors upon running the code:
Error: Cannot find module 'google-map-react'
./src/components/partials/Test.jsx
Module not found: Can't resolve 'google-map-react' in '/usr/local/bab/src/components/partials'
The path referenced in the second error appears to be incorrect as it mentions /usr/local
while my app is located at ~/www/...
I am uncertain about what I may have done incorrectly. Note that the library has not been installed globally and I even attempted removing it using
npm uninstall -g google-map-react
, but did not see any improvement.
System: Ubuntu 18.04
Node: v10.15.3
NPM: 6.4.1
Here is a snippet from my package.json
file:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/polyfill": "^7.2.5",
"@babel/runtime": "^7.2.0",
"axios": "^0.18.0",
"google-map-react": "^1.1.4",
"moment": "^2.23.0",
"node-sass": "^4.11.0",
"prop-types": "^15.6.2",
...
},
"scripts": {
...
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
...
}
}