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

Cannot run DB_TYPE=pg npm run watch #94

Closed
AntonRich opened this issue Oct 26, 2018 · 10 comments
Closed

Cannot run DB_TYPE=pg npm run watch #94

AntonRich opened this issue Oct 26, 2018 · 10 comments

Comments

@AntonRich
Copy link

OS: Ubuntu 16.04
Node: v9.11.2
Nodejs: v4.2.6
NPM: 5.6.0
Postgresql: psql (PostgreSQL) 11.0 (Ubuntu 11.0-1.pgdg16.04+2)

After running the command: DB_TYPE=pg npm run watch

I get this:

@mikeworks/sql-fundamentals@0.0.0-development watch /home/anton_rich/Projects/sql/northwind
scripty

Executing "/home/anton_rich/Projects/sql/northwind/scripts/watch.sh":

#!/usr/bin/env sh
./node_modules/.bin/nodemon -x "npm run build; npm start"

[nodemon] 1.18.3
[nodemon] to restart at any time, enter rs
[nodemon] watching: /home/anton_rich/Projects/sql/northwind/src//* /home/anton_rich/Projects/sql/northwind/views//* /home/anton_rich/Projects/sql/northwind/public/**/*
[nodemon] starting npm run build; npm start

@mikeworks/sql-fundamentals@0.0.0-development build /home/anton_rich/Projects/sql/northwind
scripty

Executing "/home/anton_rich/Projects/sql/northwind/scripts/build.sh":

#!/usr/bin/env sh
./node_modules/.bin/tsc

node_modules/@types/handlebars/index.d.ts:28:9 - error TS2687: All declarations of 'data' must have identical modifiers.

28 data?: any;
~~~~

src/db/postgres-db.ts:77:27 - error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.

77 let pgdb = new this(client);
~~~~~~

src/db/postgres-db.ts:101:30 - error TS2339: Property 'release' does not exist on type 'Client'.

101 PostgresDB.pubSubSupport.release();
~~~~~~~

src/db/postgres-pubsub.ts:6:3 - error TS2322: Type 'PoolClient' is not assignable to type 'Client'.
Property 'end' is missing in type 'PoolClient'.

6 return client;
~~~~~~~~~~~~~~

src/db/sqlite-db.ts:4:25 - error TS2307: Cannot find module 'sqlite'.

4 import * as sqlite from 'sqlite';
~~~~~~~~

src/types/handlebars.d.ts:13:5 - error TS2717: Subsequent property declarations must have the same type. Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.

13 hash: { [key: string]: any };
~~~~

src/types/handlebars.d.ts:14:5 - error TS2717: Subsequent property declarations must have the same type. Property 'fn' must be of type 'TemplateDelegate', but here has type '(ctxt: any) => {}'.

14 fn: (ctxt: any) => {};
~~

src/types/handlebars.d.ts:15:5 - error TS2687: All declarations of 'data' must have identical modifiers.

15 data: {
~~~~

src/types/handlebars.d.ts:15:5 - error TS2717: Subsequent property declarations must have the same type. Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.

15 data: {
~~~~

src/ws.ts:54:19 - error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
The 'this' types of each signature are incompatible.
Type 'WebSocket' is not assignable to type 'WebSocket'. Two different types with this name exist, but they are unrelated.
Property 'isAlive' is missing in type 'WebSocket'.

54 ws.on('pong', heartbeat);
~~~~~~~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @mikeworks/sql-fundamentals@0.0.0-development build: scripty
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @mikeworks/sql-fundamentals@0.0.0-development build 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/anton_rich/.npm/_logs/2018-10-26T23_07_43_447Z-debug.log

@mikeworks/sql-fundamentals@0.0.0-development start /home/anton_rich/Projects/sql/northwind
scripty

Executing "/home/anton_rich/Projects/sql/northwind/scripts/start.sh":

#!/usr/bin/env sh
node dist/index.js

info: Database Type: PostgreSQL
(node:30291) UnhandledPromiseRejectionWarning: TypeError: winston.createLogger is not a function
at Object.logger (/home/anton_rich/Projects/sql/northwind/node_modules/express-winston/index.js:195:67)
at installMiddlewares (/home/anton_rich/Projects/sql/northwind/dist/express-server.js:55:28)
at Object. (/home/anton_rich/Projects/sql/northwind/dist/express-server.js:99:9)
at Generator.next ()
at fulfilled (/home/anton_rich/Projects/sql/northwind/dist/express-server.js:4:58)
(node:30291) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:30291) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[nodemon] clean exit - waiting for changes before restart

@achisholm
Copy link

I'm getting something somewhat similar on macOS:

OS: MacOS v10.14
Node: v10.11.0
NPM: v6.4.1
PostgreSQL: v10.5

I read in another issue that killall -9 node might help, but that didn't work for me.

$ DB_TYPE=pg npm run watch

> @mikeworks/sql-fundamentals@0.0.0-development watch /Users/alistair/Projects/sql
> scripty

Executing "/Users/alistair/Projects/sql/scripts/watch.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/nodemon -x "npm run build; npm start"
> 


[nodemon] 1.18.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/alistair/Projects/sql/src/**/* /Users/alistair/Projects/sql/views/**/* /Users/alistair/Projects/sql/public/**/*
[nodemon] starting `npm run build; npm start`

> @mikeworks/sql-fundamentals@0.0.0-development build /Users/alistair/Projects/sql
> scripty

Executing "/Users/alistair/Projects/sql/scripts/build.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/tsc


node_modules/@types/handlebars/index.d.ts:28:9 - error TS2687: All declarations of 'data' must have identical modifiers.

28         data?: any;
           ~~~~

src/db/postgres-db.ts:77:27 - error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.

77       let pgdb = new this(client);
                             ~~~~~~

src/db/postgres-db.ts:101:30 - error TS2339: Property 'release' does not exist on type 'Client'.

101     PostgresDB.pubSubSupport.release();
                                 ~~~~~~~

src/db/postgres-pubsub.ts:6:3 - error TS2322: Type 'PoolClient' is not assignable to type 'Client'.
  Property 'end' is missing in type 'PoolClient'.

6   return client;
    ~~~~~~~~~~~~~~

src/types/handlebars.d.ts:13:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.

13     hash: { [key: string]: any };
       ~~~~

src/types/handlebars.d.ts:14:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'fn' must be of type 'TemplateDelegate<any>', but here has type '(ctxt: any) => {}'.

14     fn: (ctxt: any) => {};
       ~~

src/types/handlebars.d.ts:15:5 - error TS2687: All declarations of 'data' must have identical modifiers.

15     data: {
       ~~~~

src/types/handlebars.d.ts:15:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.

15     data: {
       ~~~~

src/ws.ts:54:19 - error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
  The 'this' types of each signature are incompatible.
    Type 'WebSocket' is not assignable to type 'WebSocket'. Two different types with this name exist, but they are unrelated.
      Property 'isAlive' is missing in type 'WebSocket'.

54     ws.on('pong', heartbeat);
                     ~~~~~~~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @mikeworks/sql-fundamentals@0.0.0-development build: `scripty`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @mikeworks/sql-fundamentals@0.0.0-development build 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!     /Users/alistair/.npm/_logs/2018-11-03T18_39_00_741Z-debug.log

> @mikeworks/sql-fundamentals@0.0.0-development start /Users/alistair/Projects/sql
> scripty

Executing "/Users/alistair/Projects/sql/scripts/start.sh":

> #!/usr/bin/env sh
> node dist/index.js


info: Database Type: PostgreSQL
(node:97418) UnhandledPromiseRejectionWarning: TypeError: winston.createLogger is not a function
    at Object.logger (/Users/alistair/Projects/sql/node_modules/express-winston/index.js:195:67)
    at installMiddlewares (/Users/alistair/Projects/sql/dist/express-server.js:55:28)
    at Object.<anonymous> (/Users/alistair/Projects/sql/dist/express-server.js:99:9)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/alistair/Projects/sql/dist/express-server.js:4:58)
(node:97418) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:97418) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[nodemon] clean exit - waiting for changes before restart

Here is the contents of the log file:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.11.0/bin/node',
1 verbose cli   '/Users/alistair/Projects/sql/node_modules/.bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@6.4.1
3 info using node@v10.11.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle @mikeworks/sql-fundamentals@0.0.0-development~prebuild: @mikeworks/sql-fundamentals@0.0.0-development
6 info lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: @mikeworks/sql-fundamentals@0.0.0-development
7 verbose lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: unsafe-perm in lifecycle true
8 verbose lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: PATH: /Users/alistair/Projects/sql/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/alistair/Projects/sql/node_modules/.bin:/Users/alistair/Projects/sql/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/alistair/Projects/sql/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: CWD: /Users/alistair/Projects/sql
10 silly lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: Args: [ '-c', 'scripty' ]
11 silly lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: Returned: code: 2  signal: null
12 info lifecycle @mikeworks/sql-fundamentals@0.0.0-development~build: Failed to exec build script
13 verbose stack Error: @mikeworks/sql-fundamentals@0.0.0-development build: `scripty`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/Users/alistair/Projects/sql/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/alistair/Projects/sql/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid @mikeworks/sql-fundamentals@0.0.0-development
15 verbose cwd /Users/alistair/Projects/sql
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/Cellar/node/10.11.0/bin/node" "/Users/alistair/Projects/sql/node_modules/.bin/npm" "run" "build"
18 verbose node v10.11.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error @mikeworks/sql-fundamentals@0.0.0-development build: `scripty`
22 error Exit status 2
23 error Failed at the @mikeworks/sql-fundamentals@0.0.0-development build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

@AntonRich
Copy link
Author

AntonRich commented Nov 4, 2018

killall -9 node
Didn't work for me as well.
By the way, since then I have updated my node to the latest 10th version. But the problem is still persisted.

@Oodmincheg
Copy link

Have the same issue on Ubuntu 18 :(

@Oodmincheg
Copy link

Worked for me after update winston package. #43

@achisholm
Copy link

Updating the Winston package, running npm upgrade & npm audit fix I was able to get my local server up and running. Still getting errors, although I'm now able to continue with the course.

@AntonRich
Copy link
Author

Yes, running and npm upgrade and and update winston package helped.

@mike-north
Copy link
Member

This should be good to go, now that renovate bot keeps dependencies (including winston) up-to-date

@mangosing
Copy link

Any fix found for this. I am on a Mac and still get errors, the code is below.

> @mikeworks/sql-fundamentals@0.0.0-development watch /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals
> scripty

Executing "/Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/scripts/watch.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/nodemon -x "npm run build; npm start"
>


[nodemon] 1.18.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/src/**/* /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/views/**/* /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/public/**/*
[nodemon] starting `npm run build; npm start`

> @mikeworks/sql-fundamentals@0.0.0-development build /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals
> scripty

Executing "/Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/scripts/build.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/tsc


node_modules/@types/handlebars/index.d.ts:28:9 - error TS2687: All declarations of 'data' must have identical modifiers.

28         data?: any;
           ~~~~

src/db/postgres-db.ts:77:27 - error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.

77       let pgdb = new this(client);
                             ~~~~~~

src/db/postgres-db.ts:101:30 - error TS2339: Property 'release' does not exist on type 'Client'.

101     PostgresDB.pubSubSupport.release();
                                 ~~~~~~~

src/db/postgres-pubsub.ts:6:3 - error TS2741: Property 'end' is missing in type 'PoolClient' but required in type 'Client'.

6   return client;
    ~~~~~~~~~~~~~~

  node_modules/@types/pg/index.d.ts:201:5
    201     end(): Promise<void>;
            ~~~
    'end' is declared here.

src/express-server.ts:57:11 - error TS2345: Argument of type '{ colorize: boolean; }' is not assignable to parameter of type 'ConsoleTransportOptions'.
  Object literal may only specify known properties, and 'colorize' does not exist in type 'ConsoleTransportOptions'.

57           colorize: true
             ~~~~~~~~~~~~~~

src/types/handlebars.d.ts:13:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.

13     hash: { [key: string]: any };
       ~~~~

src/types/handlebars.d.ts:14:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'fn' must be of type 'TemplateDelegate<any>', but here has type '(ctxt: any) => {}'.

14     fn: (ctxt: any) => {};
       ~~

src/types/handlebars.d.ts:15:5 - error TS2687: All declarations of 'data' must have identical modifiers.

15     data: {
       ~~~~

src/types/handlebars.d.ts:15:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.

15     data: {
       ~~~~

src/ws.ts:26:5 - error TS2322: Type 'Timeout' is not assignable to type 'number'.

26     this.heartbeatInterval = setInterval(
       ~~~~~~~~~~~~~~~~~~~~~~

src/ws.ts:54:19 - error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
  The 'this' types of each signature are incompatible.
    Property 'isAlive' is missing in type 'WebSocket' but required in type 'WebSocket'.

54     ws.on('pong', heartbeat);
                     ~~~~~~~~~

  src/ws.ts:9:3
    9   isAlive: boolean;
        ~~~~~~~
    'isAlive' is declared here.


Found 11 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @mikeworks/sql-fundamentals@0.0.0-development build: `scripty`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @mikeworks/sql-fundamentals@0.0.0-development build 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!     /Users/seanmangosing/.npm/_logs/2018-12-08T21_59_10_273Z-debug.log

> @mikeworks/sql-fundamentals@0.0.0-development start /Users/seanmangosing/Documents/frontend_masters/sql-fundamentals
> scripty

Executing "/Users/seanmangosing/Documents/frontend_masters/sql-fundamentals/scripts/start.sh":

> #!/usr/bin/env sh
> node dist/index.js


[winston] Attempt to write logs with no transports {"message":"Database Type: PostgreSQL","level":"info"}
[winston] Attempt to write logs with no transports {"message":"Server listening on http://localhost:3000","level":"info"}

@mike-north
Copy link
Member

@mangosing These look very similar to some bugs I fixed yesterday. Can you verify that you've pulled in the latest changes from master, removed node_modules and run yarn install again, and are still seeing these problems?

If so, please open a new issue, and I'll be sure to give it some attention

@mangosing
Copy link

That worked. Thanks so much @mike-north!

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

5 participants