Description
Just tossing this in here to help anyone who might have the same issue. Couldn't find anything about it using a search engine.
While using the vue3-google-map project, which relied on this library, I encountered the following error:
6:22:41 PM: > vue-cli-service build
6:22:41 PM: - Building for production...
6:22:57 PM: ERROR Failed to compile with 1 error
6:22:57 PM: Failed to resolve loader: @googlemaps/js-api-loader
6:22:57 PM: You may need to install it.
6:22:57 PM: ERROR Build failed with errors.
This error was only encountered on Netlify but did not happen locally.
While scrolling through the logs I noticed some output that suggested Netlify was using Node.js v12 while locally I was running Node.js v16. Netlify honors the .node-version
file for deciding which version of Node.js to use. To bump this to v16 I ran the following command and checked the file in:
echo '16.3.0' > .node-version
Once that was complete the build would succeed on Netlify.
I don't know if such documentation is a better fit in this repo or in "vue3-google-map", but with the error message listing the name of this repo I felt it wouldn't hurt to paste this here.