0

I have cloned the repo for snack-web locally.
Followed the instructions as mentioned in the Readme.
But getting below issue:

$ if-env NODE_ENV=production && yarn start:prod || yarn start:dev
$ yarn domain
$ hotel start && hotel add http://localhost:3011 --name snack.expo
Started http://localhost:2000
Create ~\.hotel\servers\snack.expo.json
$ nodemon -e json,js,ts,tsx --watch src/server src/server/index.tsx --exec babel-node --extensions '.ts,.tsx'
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): src\server\**\*
[nodemon] watching extensions: json,js,ts,tsx
[nodemon] starting `babel-node src/server/index.tsx --extensions '.ts,.tsx'`
D:\projects\snack-web\src\server\index.tsx:3
import path from 'path';
       ^^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at Object.<anonymous> (D:\projects\snack-web\node_modules\@babel\node\lib\_babel-node.js:174:21)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
[nodemon] app crashed - waiting for file changes before starting...

Issue is already opened in github, but no reply.
Does anyone here on SO help me resolve this issue? Or help understand what is the real cause? Any workarounds?
Thanks!!

rahoolm
  • 733
  • 2
  • 12
  • 22

1 Answers1

1

I think because of single quote in start:dev command. cmd does't support single quote. try change package.json line 9 to this
"start:dev": "nodemon -e json,js,ts,tsx --watch src/server src/server/index.tsx --exec babel-node --extensions \".ts,.tsx\"",

Saf
  • 318
  • 3
  • 13
  • Did that but a new error is coming now. `D:\projects\snack\snack-web\node_modules\nullthrows\nullthrows.js:9 throw error; ^ Error: Got unexpected undefined at nullthrows (D:\projects\snack\snack-web\node_modules\nullthrows\nullthrows.js:7:15) at Object. (D:\projects\snack\snack-web\src\server/EmbeddedSnackScript.tsx:6:14)` – rahoolm Dec 11 '19 at 08:58
  • That error most probably because you haven't yet set the environment variables Make sure you have the environment variables available: export SNACK_PORT=3011 export SNACK_SEGMENT_KEY="" export SNACK_SENTRY_DSN="" export SNACK_SERVER_HOST=snack.expo.test export SNACK_SERVER_PROTOCOL=https export API_SERVER_URL=https://staging.expo.io export IMPORT_SERVER_URL=https://staging.snackager.expo.io – Saf Dec 11 '19 at 09:24
  • Yes, you are right. Thanks. But now it says invalid DSN, do I need KEY and DSN values and do you know the same? – rahoolm Dec 11 '19 at 09:31
  • Finally, it is working. Thanks to you. Also, tip for someone who want to work on windows powershell. variables don't work as expected. For you need to use "FALSE" and for DSN - you might need to edit config file. sometimes single quotes are useful. Very weird behaviour. – rahoolm Dec 13 '19 at 05:39
  • What exactly did you do to fix the problem – Claret Nnamocha Jan 20 '20 at 20:37
  • @rahoolm pls help – Claret Nnamocha Jan 21 '20 at 19:25
  • @ClaretNnamocha have you tried this https://github.com/expo/snack-web/issues/13#issuecomment-564481209 – Saf Jan 22 '20 at 02:18
  • The question I have is where to put the single quotes @Saf – Claret Nnamocha Jan 22 '20 at 02:20
  • @ClaretNnamocha see answers on this question on how to set environment variables on windows https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows – Saf Jan 22 '20 at 02:26
  • I have tried that but it goes back to being undefined. Please if you have a working version could you publish it on GitHub so I could check it out @Saf – Claret Nnamocha Jan 22 '20 at 02:35
  • @ClaretNnamocha try restarting your computer. – Saf Jan 22 '20 at 02:39
  • Just restarted, it didn't make a difference @Saf – Claret Nnamocha Jan 22 '20 at 02:48
  • Sorry @ClaretNnamocha haven't check it since many days. set it to false. $env:SNACK_SENTRY_DSN=''FALSE", you can directly modify a file in node_modules where the code is written. Lets continue on github. – rahoolm Jan 23 '20 at 12:16