Ocelot-Social-Community / Ocelot-Social

Free and open-source social network for active citizenship.
https://ocelot.social
Other
92 stars 36 forks source link

SyntaxError: Unexpected token ... #331

Closed Tirokk closed 3 years ago

Tirokk commented 3 years ago

dineshlt Authored by dineshlt Closed

HI

I have successfully installed Nitro-Backend package using the below guide

https://docs.human-connection.org/nitro/backend/installation

If I start nitro backend using this command npm run start am getting the below issue

> human-connection-backend@0.0.1 start /home/android/Human Connection/Nitro-Backend
> node dist/

/home/android/Human Connection/Nitro-Backend/dist/graphql-schema.js:28
  Query: { ..._statistics.default.Query,
           ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/android/Human Connection/Nitro-Backend/dist/server.js:12:22)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! human-connection-backend@0.0.1 start: `node dist/`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the human-connection-backend@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/android/.npm/_logs/2019-03-28T11_45_14_468Z-debug.log

I am getting the issue for graphql-schema.js file. so I have installed neo4j Desktop and configured using that same guide.

Successfully installed and ran this local server http://localhost:7474/browser/ and also created Indices in Neo4j by using the below commands.

$ CALL db.index.fulltext.createNodeIndex("full_text_search",["Post"],["title", "content"]);

But I can't able to Seed Database with Data

If I run this command npm run db:seed I am getting the below syntax error

> human-connection-backend@0.0.1 db:seed /home/android/Human Connection/Nitro-Backend
> $npm_package_config_no_auth run-p --race dev db:script:seed

> human-connection-backend@0.0.1 dev /home/android/Human Connection/Nitro-Backend
> nodemon --exec babel-node src/ -e js,graphql

> human-connection-backend@0.0.1 db:script:seed /home/android/Human Connection/Nitro-Backend
> wait-on tcp:4001 && babel-node src/seed/seed-db.js

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node src/`
/home/android/Human Connection/Nitro-Backend/src/graphql-schema.js:28
  Query: { ..._statistics.default.Query,
           ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Module._compile (/home/android/Human Connection/Nitro-Backend/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:580:10)
    at Object.newLoader [as .js] (/home/android/Human Connection/Nitro-Backend/node_modules/pirates/lib/index.js:104:7)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
[nodemon] app crashed - waiting for file changes before starting...

Kindly give any needfull suggestion.

Tirokk commented 3 years ago

roschaefer Authored by roschaefer


Hey @dineshlt I'm so sorry that you we guided you in the wrong direction Since one week we have a monorepo, ie. all services are placed in one repository called /Human-Connection/Human-Connection.

Could you clone that repo, switch into folder backend, install dependencies yarn install and run yarn run dev?

By the way, the above error looks like you don't use babel-node but plain node. Use npm run dev or yarn run dev.

Please document all the steps and update the documentation! https://github.com/Human-Connection/Nitro-Documentation/blob/master/backend/installation/README.md

Thanks a lot!

Tirokk commented 3 years ago

dineshlt Authored by dineshlt


Hi @roschaefer

Thanks for your guide. I have installed and changed the plain node into babel node.

But now I am facing babel mismatching error given below:

/home/android/Human Connection/Human-Connection/backend/node_modules/@babel/helper-plugin-utils/lib/index.js:72
  throw Object.assign(err, {
  ^
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.

I have upgraded babel-core@6.26.3 to babel-core@7.0.0 but I still face the same issue

npm -- 6.4.1
node --8.1.3

I have used above node and npm version. Kindly give any needfull suggestion on which babel vesion will support my npm and node version.

Tirokk commented 3 years ago

ulfgebhardt Authored by ulfgebhardt


cannot reproduce.

Can you provide OS, yarn --version and node --version

Tirokk commented 3 years ago

roschaefer Authored by roschaefer


@dineshlt did you find your way to our real-time chat already? https://discordapp.com/invite/6ub73U3

Tirokk commented 3 years ago

roschaefer Authored by roschaefer


@dineshlt here are my versions:

robert@e480 ~> yarn --version
1.13.0
robert@e480 ~> node --version
v10.15.1

@dineshlt today we found out that we have a constraint that you will need a recent node version because of a dependeny on crypto. You can always use the docker installation to get the most reliable, hassle-free setup.

Tirokk commented 3 years ago

dineshlt Authored by dineshlt


Hi @roschaefer

Thanks for your guide. I have updated my node version from 8.1.3 into the 11.13.0.

Now successfully running backend in http://localhost:4000/ also web app in http://localhost:3000/

But I can't able to login in the web app.

user@example.org

moderator@example.org

admin@example.org

Password: 1234 (same for all profiles)

I have used the above 3 logins. It's showing the below issue

Error: GraphQL error: The client is unauthorized due to authentication failure.

screenshot: https://prnt.sc/n6u8nw

Kindly let me know how to resolve it

Thanks...

Tirokk commented 3 years ago

roschaefer Authored by roschaefer


@dineshlt probably because your Neo4J database is empty. You have to yarn run db:seed in backend. If you do the local installation without docker, you should run this script to create unique constraints. Otherwise you will have some failing tests if you do yarn run test.

so: 1) Seed the database (to login successfully) 2) Create unique constraints (to let all backend tests pass)

I'll close this because I've seen you found your way on Discord.