fullstackreact / google-maps-react

Companion code to the "How to Write a Google Maps React Component" Tutorial
https://www.fullstackreact.com/articles/how-to-write-a-google-maps-react-component/
MIT License
1.64k stars 818 forks source link

Error: ENOENT: no such file or directory, open '.env' #223

Open neonb88 opened 6 years ago

neonb88 commented 6 years ago

EDIT: does this only work on Arch or MacOS? Some of the error messages suggest that, at least, some features are only available on Arch Linux and Mac OSX Darwin

EDIT: I have tried both make test and make testwatch, and they worked.

I am trying to build the first example to show on the screen. Very new to NodeJS and webdev. Please let me know any/all of the barest bones, stupidest intro-level stuff that I'm doing wrong. Here is the sequence of commands and the error stacktrace:

Input

mkdir tmp && cd tmp
git clone https://github.com/fullstackreact/google-maps-react.git && cd google-maps-react
vim .env.example   # here I change the api key to AIzaSyAyesbQMyKVVbBgKVi2g6VX7mop2z96jBo
npm install
npm audit fix
make example

Output

Cloning into 'google-maps-react'...
remote: Counting objects: 1331, done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 1331 (delta 61), reused 56 (delta 26), pack-reused 1220
Receiving objects: 100% (1331/1331), 1.39 MiB | 2.72 MiB/s, done.
Resolving deltas: 100% (810/810), done.
Checking connectivity... done.
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> google-maps-react@2.0.2 prepublish /home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react
> ./scripts/prepublish.sh

=> Transpiling...

src/GoogleApiComponent.js -> dist/GoogleApiComponent.js
src/components/HeatMap.js -> dist/components/HeatMap.js
src/components/InfoWindow.js -> dist/components/InfoWindow.js
src/components/Marker.js -> dist/components/Marker.js
src/components/Polygon.js -> dist/components/Polygon.js
src/components/Polyline.js -> dist/components/Polyline.js
src/index.js -> dist/index.js
src/lib/GoogleApi.js -> dist/lib/GoogleApi.js
src/lib/ScriptCache.js -> dist/lib/ScriptCache.js
src/lib/String.js -> dist/lib/String.js
src/lib/arePathsEqual.js -> dist/lib/arePathsEqual.js
src/lib/cancelablePromise.js -> dist/lib/cancelablePromise.js
src/lib/windowOrGlobal.js -> dist/lib/windowOrGlobal.js

=> Complete
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 881 packages from 1316 contributors and audited 8471 packages in 13.649s
found 453 vulnerabilities (404 low, 30 moderate, 16 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

> nodemon@1.17.5 postinstall /home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react/node_modules/nodemon
> node bin/postinstall || exit 0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ gh-pages@1.2.0
+ nodemon@1.17.5
+ babel-core@6.26.3
added 290 packages from 138 contributors, removed 30 packages, updated 35 packages and moved 3 packages in 20.821s
fixed 417 of 453 vulnerabilities in 8471 scanned packages
  5 package updates for 36 vulns involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or do it by hand)
npm run prepublish

> google-maps-react@2.0.2 prepublish /home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react
> ./scripts/prepublish.sh

=> Transpiling...

src/GoogleApiComponent.js -> dist/GoogleApiComponent.js
src/components/HeatMap.js -> dist/components/HeatMap.js
src/components/InfoWindow.js -> dist/components/InfoWindow.js
src/components/Marker.js -> dist/components/Marker.js
src/components/Polygon.js -> dist/components/Polygon.js
src/components/Polyline.js -> dist/components/Polyline.js
src/index.js -> dist/index.js
src/lib/GoogleApi.js -> dist/lib/GoogleApi.js
src/lib/ScriptCache.js -> dist/lib/ScriptCache.js
src/lib/String.js -> dist/lib/String.js
src/lib/arePathsEqual.js -> dist/lib/arePathsEqual.js
src/lib/cancelablePromise.js -> dist/lib/cancelablePromise.js
src/lib/windowOrGlobal.js -> dist/lib/windowOrGlobal.js

=> Complete
npm run build

> google-maps-react@2.0.2 build /home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react
> NODE_ENV=production webpack

{ Error: ENOENT: no such file or directory, open '.env'
    at Object.fs.openSync (fs.js:579:3)
    at Object.fs.readFileSync (fs.js:485:33)
    at Object.config (/home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react/node_modules/dotenv/lib/main.js:30:37)
    at Object.<anonymous> (/home/n/Documents/IMPORTANT/business_work/cat/get_clothing_sizes_from_pix/cat_1st_demo/mobile/tmp/google-maps-react/webpack.config.js:51:29)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17) errno: -2, syscall: 'open', code: 'ENOENT', path: '.env' }
Hash: cd7a0d15339250e756dc
Version: webpack 1.15.0
Time: 7533ms
                      Asset       Size  Chunks             Chunk Names
 google-maps-react.2.0.2.js     830 kB       0  [emitted]  main
google-maps-react.2.0.2.css    1.91 kB       0  [emitted]  main
                 index.html  281 bytes          [emitted]  
   [0] multi main 28 bytes {0} [built]
    + 433 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules

What I think is going wrong:

Apparently I should be using "prepare" :

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Way-U-Need commented 5 years ago

same problem ...any solution?

GalucioSilva commented 5 years ago

same problem, any solution ???? /2

Way-U-Need commented 5 years ago

I just removed/delete the node_modules and install the it again