Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running boilerplated code #287

Open
alpeshrpatel opened this issue Mar 11, 2018 · 21 comments
Open

Error while running boilerplated code #287

alpeshrpatel opened this issue Mar 11, 2018 · 21 comments

Comments

@alpeshrpatel
Copy link

I m facing with this. Can someone please suggest something ?

(undefined) ./src/account/Account.js
Module not found: Can't resolve './generated/AccountFragment.graphql' in '/Users/alpeshpatel/workspace/javascript/react/react-firebase-starter/src/account'

@koistya
Copy link
Member

koistya commented Mar 12, 2018

You need to pre-compile GraphQL queries used in code before launching the app either by running yarn relay or yarn relay --watch (in "watch" mode).

@alpeshrpatel
Copy link
Author

alpeshrpatel commented Mar 14, 2018

Still facing on this issue.

alpeshpatel@XXXXXXXX:~/workspace/javascript/react/react-firebase-starter$yarn relay
yarn run v1.5.1
$ relay-compiler --src ./src --schema ./src/schema.graphql --include "**/*.js"
2018-03-14T11:55:15,351: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/alpeshpatel-state/sock! (No such file or directory)

Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-03-14T11:55:15,351: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/alpeshpatel-state/sock! (No such file or directory)

HINT: pass --watch to keep watching for changes.

Writing js
Unchanged: 0 files
✨ Done in 143.70s.

@koistya
Copy link
Member

koistya commented Mar 14, 2018

@alpeshrpatel do you have Facebook's Watchman installed? What version? watchman --version

@alpeshrpatel
Copy link
Author

[email protected]:~/workspace/javascript/react/react-firebase-starter$watchman --version
4.9.0

@koistya
Copy link
Member

koistya commented Mar 14, 2018

Try get get logs from watchman, here is a related issue facebook/watchman#143

@nnmrts
Copy link

nnmrts commented Mar 16, 2018

Some change in the last few days broke this starter repo. I used it successfully a week ago, now when I run yarn setup it exits with this after installing the dependencies:

[4/4] Building fresh packages...
success Saved lockfile.
{ Error: connect ECONNREFUSED 127.0.0.1:5432
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432 }
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c node ./scripts/setup
Directory: /home/nnmrts/projects/bibliopol3
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/home/nnmrts/projects/bibliopol3/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

EDIT: This issue and the issue described in the first post comes from not editing the .env file.


However, how do I correctly edit this file? Firebase config is obvious, but how do I have to set the postgresql vars? What should PGPASSWORD be? What is this thing even and why do I need it? I thought this starter uses graphql?

@nnmrts
Copy link

nnmrts commented Mar 16, 2018

Don't know if this is useful, but I got it working now:
The readme.md "getting started" section should be rewritten to this:

First clone the repository in a directory and cd into it:

git clone https://github.com/kriasoft/react-firebase-starter.git MyApp
cd MyApp

Then install PostgreSQL if it isn't already installed and give the default user a password:

sudo -u postgres psql // login to postgresql shell
ALTER USER postgres PASSWORD 'your_password'; // add a password

Then edit the firebase config in the .env file and add that password above to the postgres config:

PGHOST=localhost
PGUSER=postgres
PGDATABASE=app
PGPASSWORD=your_password
PGPORT=5432
# PGSSLMODE=require
PGSSLMODE=disable

Now setup and start your app:
yarn setup && yarn start

PS: Be sure to either add your .env file to your .gitignore file or rename it to .env.local, otherwise other people can see your postgres password and firebase keys when you git push your source code somewhere.

@alpeshrpatel
Copy link
Author

Does that mean i need postgres locally install ? i dont want it then what would be steps to follow ?

@koistya
Copy link
Member

koistya commented Mar 16, 2018

@alpeshrpatel you would just need to modify src/graphql/user/mutations.js => signIn() mutation and src/graphql/user/UserType.js to use some other storage, e.g. in Firestore. After that, you will be able to sign in. And remove stories/comments from the project, as they are just examples.

@koistya
Copy link
Member

koistya commented Mar 16, 2018

@nnmrts you can use "postgres" account without a password (a password being an empty string), in that case, the yarn setup script with default settings should bootstrap a new database without any issues. Yeah, it would be nice to add a comment to .env file that it should not contain any real secrets/passwords if the project is being pushed to a public repo. A pull request is more than welcome!

@nnmrts
Copy link

nnmrts commented Mar 17, 2018

@koistya I also read that "without a password"-thing somewhere else, but for my machine (linux debian 32 bit) this didn't work. Maybe that was just because I manually installed the desktop environment. :/

Nevertheless, I still can't deploy my project because of this:

Error: Error parsing triggers: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module '/home/nnmrts/projects/bibliopol3/node_modules/@google-cloud/common-grpc/node_modules/grpc/src/node/extension_binary/node-v59-linux-ia32-glibc/grpc_node.node'

Try running "npm install" in your functions directory before deploying.

Weird enough, because there is no functions directory. Still don't know if this is related, but it's definitely an edge case...should I open a new issue for this?

(also, I'm afraid to run npm rebuild now, because I use yarn and npm would screw everything up :D (I will still try it though))

Anyway, how do I solve this?


EDIT: I should also point out that deploying went fine until I installed a dependency with yarn and required it in server.js.

@nnmrts
Copy link

nnmrts commented Mar 17, 2018

My suggestion is to fully remove PostgreSQL from this starter. It's just an overload. This starter really worked great a week ago and now it just feels painful to work with.


EDIT: `npm rebuild` fixed it for me, but still, I don't see why this starter needs PostgreSQL...

@alpeshrpatel
Copy link
Author

alpeshrpatel commented Mar 19, 2018

Please keep me posted once you remove postgreSQL from start kit.
I would say RDBMS should be user preference instead of PostgreSQL. If use want then they can involve them self

@koistya
Copy link
Member

koistya commented Mar 19, 2018

@alpeshrpatel you still need a database for data, right? Can I ask, what kind of data you need to store and what db are you going to use instead of Postgres?

@alpeshrpatel
Copy link
Author

alpeshrpatel commented Mar 19, 2018

I am planning to use mongo and firebase. Starter kit should not depend on any DB. Its should generic. Let me know if you need more info on this.

@nnmrts
Copy link

nnmrts commented Mar 20, 2018

@alpeshrpatel cosign

@alpeshrpatel
Copy link
Author

Any luck on this ?

@nnmrts
Copy link

nnmrts commented Mar 23, 2018

@alpeshrpatel I'm planning to release an easier starter, based on an earlier version of this starter. I used it myself for the last two months. It's not dependent on any database framework and just works fine.

@nnmrts
Copy link

nnmrts commented Mar 23, 2018

@alpeshrpatel But protip: You just can clone any version before this commit: e255dfc

and then remove the graphql dependencies and the components that use it. Removing PostgreSQL in the current version is way harder. Also, in this earlier version you just need to enter yarn to start your project.

@nnmrts
Copy link

nnmrts commented Mar 23, 2018

Unfortunately this repo doesn't use git tags and releases the way they should be used. The one and only release is this, but it's almost two years old and I never tried it out. It probably works too, but much luck with updating the dependencies.

Any thoughts on this, @koistya?

@nnmrts
Copy link

nnmrts commented Mar 23, 2018

And sorry for quadruple post, but I find it kinda sad that there is not a single usable and generic simple boilerplate for React. create-react-app works fine as a "tutorial" like project, but for simple and small real projects, there is no such thing as a boilerplate. Everything above create-react-app needs either an uneccessary complicated setup of requirements and prerequisites or is built way too opinionated to work with for most of the people. 🙍‍♀️

EDIT: Classic case of featuritis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants