w3tecch / express-typescript-boilerplate

A delightful way to building a RESTful API with NodeJs & TypeScript by @w3tecch
MIT License
3.31k stars 905 forks source link

not install with last version development #101

Closed Paul75 closed 6 years ago

Paul75 commented 6 years ago

Hello,

When I clone and do npm run sertup I have errors :

nps is executing `config` : ts-node --transpileOnly ./commands/tsconfig.ts && ts-node --transpileOnly ./commands/ormconfig.ts
seeds
🔎  found: 2 factories & 3 seeds

executing seed:   CreateBruce
Could not run seed  { QueryFailedError: ER_NO_SUCH_TABLE: La table 'safim.user' n'existe pas
    at new QueryFailedError (C:\Users\pkbp512\projets\SAFIM\web\server\src\error\QueryFailedError.ts:7:9)
    at Query._callback (C:\Users\pkbp512\projets\SAFIM\web\server\src\driver\mysql\MysqlQueryRunner.ts:157:37)
    at Query.Sequence.end (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\protocol\sequences\Sequence.js:88:24)
    at Query.ErrorPacket (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\protocol\sequences\Query.js:90:8)
    at Protocol._parsePacket (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\protocol\Protocol.js:279:23)
    at Parser.write (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\protocol\Parser.js:76:12)
    at Protocol.write (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\protocol\Protocol.js:39:16)
    at Socket.<anonymous> (C:\Users\pkbp512\projets\SAFIM\web\server\node_modules\mysql\lib\Connection.js:103:28)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
  message: 'ER_NO_SUCH_TABLE: La table \'safim.user\' n\'existe pas',
  code: 'ER_NO_SUCH_TABLE',
  errno: 1146,
  sqlMessage: 'La table \'safim.user\' n\'existe pas',
  sqlState: '42S02',
  index: 0,
  sql: 'INSERT INTO `user`(`id`, `first_name`, `last_name`, `email`) VALUES (\'a345eb10-d096-4b79-a30c-61799e571511\', \'Bruce\', \'Wayne\', \'bruce.wayne@wayne-enterprises.com\')',
  name: 'QueryFailedError',
  query: 'INSERT INTO `user`(`id`, `first_name`, `last_name`, `email`) VALUES (?, ?, ?, ?)',
  parameters:
   [ 'a345eb10-d096-4b79-a30c-61799e571511',
     'Bruce',
     'Wayne',
     'bruce.wayne@wayne-enterprises.com' ] }
The script called "db.seed" which runs "nps banner.seed && nps config && ts-node --transpileOnly ./src/lib/seed/cli.ts" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.0/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
The script called "setup.script" which runs "yarn install && nps db.drop && nps db.migrate && nps db.seed" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.0/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@3.0.1 start: `nps "setup.script"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the express-typescript-boilerplate@3.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!     C:\Users\pkbp512\AppData\Roaming\npm-cache\_logs\2018-06-04T15_05_03_238Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@3.0.1 setup: `npm start config && npm start setup.script`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the express-typescript-boilerplate@3.0.1 setup 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!     C:\Users\pkbp512\AppData\Roaming\npm-cache\_logs\2018-06-04T15_05_03_353Z-debug.log

Thanks

sebastianmacias commented 6 years ago

I'm having a similar issue:

dev@dev-x:~/go/src/github.com/hs888/ss/backend$ npm run setup

> express-typescript-boilerplate@3.0.1 presetup /home/dev/go/src/github.com/hs888/ss/backend
> yarn install

yarn install v1.7.0
warning ../package.json: No license field
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.44s.

> express-typescript-boilerplate@3.0.1 setup /home/dev/go/src/github.com/hs888/ss/backend
> npm start config && npm start setup.script

> express-typescript-boilerplate@3.0.1 start /home/dev/go/src/github.com/hs888/ss/backend
> nps "config"

nps is executing `config` : ts-node --transpileOnly ./commands/tsconfig.ts && ts-node --transpileOnly ./commands/ormconfig.ts

> express-typescript-boilerplate@3.0.1 start /home/dev/go/src/github.com/hs888/ss/backend
> nps "setup.script"

nps is executing `setup.script` : yarn install && nps db.drop && nps db.migrate && nps db.seed
yarn install v1.7.0
warning ../package.json: No license field
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.45s.
nps is executing `db.drop` : ts-node --transpileOnly ./node_modules/typeorm/cli.js schema:drop
query: START TRANSACTION
query: SELECT 'DROP TABLE IF EXISTS "' || schemaname || '"."' || tablename || '" CASCADE;' as "query" FROM "pg_tables" WHERE "schemaname" IN (current_schema())
query: DROP TABLE IF EXISTS "public"."migrations" CASCADE;
query: SELECT 'DROP TYPE IF EXISTS "' || n.nspname || '"."' || t.typname || '" CASCADE;' as "query" FROM "pg_type" "t" INNER JOIN "pg_enum" "e" ON "e"."enumtypid" = "t"."oid" INNER JOIN "pg_namespace" "n" ON "n"."oid" = "t"."typnamespace" WHERE "n"."nspname" IN (current_schema()) GROUP BY "n"."nspname", "t"."typname"
query: COMMIT
Database schema has been successfully dropped.
nps is executing `db.migrate` : nps banner.migrate && nps config && ts-node --transpileOnly ./node_modules/typeorm/cli.js migration:run
nps is executing `banner.migrate` : ts-node --transpileOnly ./commands/banner.ts migrate
            _                 _       
  _ __ ___ (_) __ _ _ __ __ _| |_ ___ 
 | '_ ` _ \| |/ _` | '__/ _` | __/ _ \
 | | | | | | | (_| | | | (_| | ||  __/
 |_| |_| |_|_|\__, |_|  \__,_|\__\___|
              |___/                   

nps is executing `config` : ts-node --transpileOnly ./commands/tsconfig.ts && ts-node --transpileOnly ./commands/ormconfig.ts
query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = current_schema() AND "table_name" = 'migrations'
query: CREATE TABLE "migrations" ("id" SERIAL NOT NULL, "timestamp" bigint NOT NULL, "name" character varying NOT NULL, CONSTRAINT "PK_8c82d7f526340ab734260ea46be" PRIMARY KEY ("id"))
query: SELECT * FROM "migrations" "migrations"
No migrations are pending
nps is executing `db.seed` : nps banner.seed && nps config && ts-node --transpileOnly ./src/lib/seed/cli.ts
nps is executing `banner.seed` : ts-node --transpileOnly ./commands/banner.ts seed
                    _ 
  ___  ___  ___  __| |
 / __|/ _ \/ _ \/ _` |
 \__ \  __/  __/ (_| |
 |___/\___|\___|\__,_|

nps is executing `config` : ts-node --transpileOnly ./commands/tsconfig.ts && ts-node --transpileOnly ./commands/ormconfig.ts
seeds
🔎  found: 2 factories & 3 seeds

executing seed:   CreateBruce
Could not run seed  { QueryFailedError: relation "user" does not exist
    at new QueryFailedError (/home/dev/go/src/github.com/hs888/ss/backend/src/error/QueryFailedError.ts:7:9)
    at Query.callback (/home/dev/go/src/github.com/hs888/ss/backend/src/driver/postgres/PostgresQueryRunner.ts:170:26)
    at Query.handleError (/home/dev/go/src/github.com/hs888/ss/backend/node_modules/pg/lib/query.js:143:17)
    at Connection.connectedErrorHandler (/home/dev/go/src/github.com/hs888/ss/backend/node_modules/pg/lib/client.js:132:26)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at Socket.<anonymous> (/home/dev/go/src/github.com/hs888/ss/backend/node_modules/pg/lib/connection.js:123:12)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
  message: 'relation "user" does not exist',
  name: 'QueryFailedError',
  length: 103,
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: '13',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_relation.c',
  line: '1180',
  routine: 'parserOpenTable',
  query: 'INSERT INTO "user"("id", "first_name", "last_name", "email") VALUES (DEFAULT, $1, $2, $3) RETURNING "id"',
  parameters: [ 'Bruce', 'Wayne', 'bruce.wayne@wayne-enterprises.com' ] }
The script called "db.seed" which runs "nps banner.seed && nps config && ts-node --transpileOnly ./src/lib/seed/cli.ts" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.0/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
The script called "setup.script" which runs "yarn install && nps db.drop && nps db.migrate && nps db.seed" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.0/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@3.0.1 start: `nps "setup.script"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the express-typescript-boilerplate@3.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/dev/.npm/_logs/2018-06-28T03_44_41_130Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@3.0.1 setup: `npm start config && npm start setup.script`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the express-typescript-boilerplate@3.0.1 setup 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/dev/.npm/_logs/2018-06-28T03_44_41_146Z-debug.log
secret-agent-B commented 6 years ago

I am getting the same thing. If you look at the database instance in pg - the tables are not there.

secret-agent-B commented 6 years ago

This worked for me

TYPEORM_MIGRATIONS_DIR=src/database/migrations TYPEORM_MIGRATIONS=src/database/migrations/*/.ts