feathers-plus / cli

FeathersJS CLI supporting both REST and GraphQL architectural concepts and their query languages.
https://generator.feathers-plus.com/
Other
43 stars 7 forks source link

Sequelize.ts error #26

Closed GhuronZhan closed 5 years ago

GhuronZhan commented 5 years ago

Hello,

I've try to follow step-by-step the "Get started" documentation (here). I have many issues, maybe it's because of the DB difference (between MongoDB/Mongoose in the tutorial and MySQL8/Sequelize in my case). This is one of the multiple TS issues i have, because I've alrealdy tried some times :

I want to understand in order to have a stable build...that can works... so one issue at a time.

Steps to reproduce

services: db: image: mysql:8.0.3 container_name: dev_mysql_8 environment:

Expected behavior

Just want to start the Feathers app for the moment...

Actual behavior

Throw an error after npm start command :

benoit@PC-SD-01:~/projects/test_fia$ npm start

> test-fia@0.0.0 start /home/benoit/projects/test_fia
> ts-node --files src/

/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/sequelize.ts(63,39): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[any?]'.
  Types of property 'length' are incompatible.
    Type 'number' is not assignable to type '0 | 1'.

    at createTSError (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:261:12)
    at getOutput (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:367:40)
    at Object.compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:558:11)
    at Module.m._compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/benoit/projects/test_fia/src/app.ts:24:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module.m._compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/benoit/projects/test_fia/src/index.ts:6:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-fia@0.0.0 start: `ts-node --files src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-fia@0.0.0 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/benoit/.npm/_logs/2019-01-30T09_09_21_689Z-debug.log

System configuration

Module versions :

"dependencies": {
    "@feathers-plus/test-utils": "^0.3.5",
    "@feathersjs/authentication": "^2.1.15",
    "@feathersjs/authentication-jwt": "^2.0.9",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "@feathersjs/socketio": "^3.2.9",
    "ajv": "^5.5.2",
    "compression": "^1.7.3",
    "cors": "^2.8.5",
    "cross-env": "^5.2.0",
    "feathers-hooks-common": "^4.20.2",
    "feathers-sequelize": "^3.1.3",
    "helmet": "^3.15.0",
    "lodash.merge": "^4.6.1",
    "mysql2": "^1.6.4",
    "sequelize": "^4.42.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "@types/compression": "0.0.36",
    "@types/cors": "^2.8.4",
    "@types/feathersjs__authentication": "^2.1.2",
    "@types/feathersjs__authentication-jwt": "^1.0.5",
    "@types/feathersjs__authentication-local": "^1.0.3",
    "@types/feathersjs__configuration": "^1.0.1",
    "@types/feathersjs__errors": "^3.2.1",
    "@types/feathersjs__express": "^1.1.4",
    "@types/feathersjs__feathers": "^3.1.1",
    "@types/feathersjs__socketio": "^3.0.3",
    "@types/helmet": "0.0.40",
    "@types/lodash.merge": "^4.6.4",
    "@types/mocha": "^5.2.5",
    "@types/request-promise": "^4.1.42",
    "@types/sequelize": "^4.27.34",
    "@types/serve-favicon": "^2.2.30",
    "@types/winston": "^2.4.4",
    "mocha": "^5.2.0",
    "nodemon": "^1.18.9",
    "request": "^2.88.0",
    "request-promise": "^4.2.2",
    "ts-mocha": "^2.0.0",
    "ts-node": "^7.0.1",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4"
  }

Node version: 10.15.0

NPM Version: 6.4.1

Feathers-Plus Version: 0.7.75

MySQL Version: 8.0.3 (as you can see in docker-compose.yml)

Operating System: Ubuntu 18.04.1 LTS

GIST Public link

(https://gist.github.com/GhuronZhan/562f7c006c38812008d0e770de43fec9)

j2L4e commented 5 years ago

@NickBolles got an idea what's going on here? Unfortunately I don't have the time to investigate this right now.

eddyystop commented 5 years ago

First, https://github.com/feathers-plus/cli/issues/27 should have been added to this issue rather than a new one created. So I am closing https://github.com/feathers-plus/cli/issues/27 .

Second, its better to post generator issues to feathers-plus/generator-feathers-plus so we don't lose sight of them. So I am opening an issue there which references this one, while closing this one here.