chriswiggins / rtsp-streaming-server

Lightweight RTSP/RTP streaming media server written in Javascript
GNU General Public License v3.0
107 stars 21 forks source link

Production installation #34

Open louis49 opened 2 years ago

louis49 commented 2 years ago

When importing from an other package, I can't install my project with a NODE_ENV="production" (aka not installing dev deps)

Log : npm ERR! code 1 npm ERR! git dep preparation failed npm ERR! command /opt/homebrew/Cellar/node/17.5.0/bin/node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/XXX/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run npm ERR! npm WARN using --force Recommended protections disabled. npm ERR! npm ERR! code 1 npm ERR! npm ERR! path /Users/XXX/.npm/_cacache/tmp/git-clone7jwn10 npm ERR! npm ERR! command failed npm ERR! npm ERR! command sh -c npm run build npm ERR! npm ERR! > rtsp-streaming-server@2.0.6 build npm ERR! npm ERR! > npm run type-check && npm run build:js npm ERR! npm ERR! npm ERR! npm ERR! npm ERR! npm ERR! > rtsp-streaming-server@2.0.6 type-check npm ERR! npm ERR! > tsc --emitDeclarationOnly npm ERR! npm ERR! npm ERR! npm ERR! src/lib/Client.ts(1,38): error TS2307: Cannot find module 'dgram' or its corresponding type declarations. npm ERR! npm ERR! src/lib/Client.ts(3,28): error TS2307: Cannot find module 'uuid' or its corresponding type declarations. npm ERR! npm ERR! src/lib/Client.ts(73,9): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/Client.ts(81,11): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/Client.ts(139,17): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! src/lib/Client.ts(139,17): error TS4073: Parameter 'buf' of public method from exported class has or is using private name 'Buffer'. npm ERR! npm ERR! src/lib/Client.ts(149,18): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! src/lib/Client.ts(149,18): error TS4073: Parameter 'buf' of public method from exported class has or is using private name 'Buffer'. npm ERR! npm ERR! src/lib/ClientServer.ts(1,23): error TS2307: Cannot find module 'basic-auth' or its corresponding type declarations. npm ERR! npm ERR! src/lib/ClientServer.ts(57,11): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/ClientServer.ts(130,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! src/lib/ClientServer.ts(170,7): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/ClientWrapper.ts(2,28): error TS2307: Cannot find module 'uuid' or its corresponding type declarations. npm ERR! npm ERR! src/lib/ClientWrapper.ts(20,22): error TS2503: Cannot find namespace 'NodeJS'. npm ERR! npm ERR! src/lib/ClientWrapper.ts(20,22): error TS4031: Public property 'keepaliveTimeout' of exported class has or is using private name 'NodeJS'. npm ERR! npm ERR! src/lib/ClientWrapper.ts(55,44): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! src/lib/ClientWrapper.ts(80,7): error TS2304: Cannot find name 'clearTimeout'. npm ERR! npm ERR! src/lib/ClientWrapper.ts(95,7): error TS2304: Cannot find name 'clearTimeout'. npm ERR! npm ERR! src/lib/ClientWrapper.ts(98,29): error TS2304: Cannot find name 'setTimeout'. npm ERR! npm ERR! src/lib/Mount.ts(1,28): error TS2307: Cannot find module 'uuid' or its corresponding type declarations. npm ERR! npm ERR! src/lib/Mount.ts(85,11): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/Mount.ts(93,13): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/Mount.ts(124,11): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/PublishServer.ts(1,23): error TS2307: Cannot find module 'basic-auth' or its corresponding type declarations. npm ERR! npm ERR! src/lib/PublishServer.ts(53,11): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/PublishServer.ts(208,7): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'. npm ERR! npm ERR! src/lib/RtpUdp.ts(1,38): error TS2307: Cannot find module 'dgram' or its corresponding type declarations. npm ERR! npm ERR! src/lib/RtpUdp.ts(20,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! src/lib/utils.ts(1,34): error TS2307: Cannot find module 'debug' or its corresponding type declarations. npm ERR! npm ERR! src/lib/utils.ts(2,21): error TS2307: Cannot find module 'url' or its corresponding type declarations. npm ERR! npm ERR! types/rtsp-server.d.ts(2,32): error TS2307: Cannot find module 'events' or its corresponding type declarations. npm ERR! npm ERR! types/rtsp-server.d.ts(3,26): error TS2307: Cannot find module 'net' or its corresponding type declarations. npm ERR! npm ERR! types/rtsp-server.d.ts(16,42): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! types/rtsp-server.d.ts(35,42): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node. npm ERR! npm ERR! npm WARN using --force Recommended protections disabled. npm ERR! npm ERR! npm WARN using --force Recommended protections disabled. npm ERR! npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! npm ERR! /Users/XXX/.npm/_logs/2022-02-28T07_07_07_635Z-debug-0.log

npm ERR! A complete log of this run can be found in: npm ERR! /Users/XXX/.npm/_logs/2022-02-28T07_07_02_118Z-debug-0.log

Also, inside package root folder, a npm clean-install --only=prod fails with a lot of logs :

npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated uuid@3.3.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.

rtsp-streaming-server@2.0.6 prepare npm run build

rtsp-streaming-server@2.0.6 build npm run type-check && npm run build:js

rtsp-streaming-server@2.0.6 type-check tsc --emitDeclarationOnly

src/lib/Client.ts:1:38 - error TS2307: Cannot find module 'dgram'.

1 import { createSocket, Socket } from 'dgram';


src/lib/Client.ts:3:28 - error TS7016: Could not find a declaration file for module 'uuid'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/uuid/index.js' implicitly has an 'any' type.
  Try `npm install @types/uuid` if it exists or add a new declaration (.d.ts) file containing `declare module 'uuid';`

3 import { v4 as uuid } from 'uuid';

src/lib/Client.ts:73:9 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'.

73 console.warn(Port error on ${e.port}, for stream ${this.stream.id} using another port);


src/lib/Client.ts:81:11 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

81           console.warn(e);

src/lib/Client.ts:139:17 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node.

139 sendRtp (buf: Buffer) {


src/lib/Client.ts:139:17 - error TS4073: Parameter 'buf' of public method from exported class has or is using private name 'Buffer'.

139   sendRtp (buf: Buffer) {

src/lib/Client.ts:149:18 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node.

149 sendRtcp (buf: Buffer) {


src/lib/Client.ts:149:18 - error TS4073: Parameter 'buf' of public method from exported class has or is using private name 'Buffer'.

149   sendRtcp (buf: Buffer) {

src/lib/ClientServer.ts:1:23 - error TS7016: Could not find a declaration file for module 'basic-auth'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/basic-auth/index.js' implicitly has an 'any' type. Try npm install @types/basic-auth if it exists or add a new declaration (.d.ts) file containing declare module 'basic-auth';

1 import { parse } from 'basic-auth';


src/lib/ClientServer.ts:57:11 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

57           console.error('Unknown ClientServer request', { method: req.method, url: req.url });

src/lib/ClientServer.ts:130:37 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node.

130 res.setHeader('Content-Length', Buffer.byteLength(mount.sdp));


src/lib/ClientServer.ts:170:7 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

170       console.error('Error setting up client', e);

src/lib/ClientWrapper.ts:2:28 - error TS7016: Could not find a declaration file for module 'uuid'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/uuid/index.js' implicitly has an 'any' type. Try npm install @types/uuid if it exists or add a new declaration (.d.ts) file containing declare module 'uuid';

2 import { v4 as uuid } from 'uuid';


src/lib/ClientWrapper.ts:20:22 - error TS2503: Cannot find namespace 'NodeJS'.

20   keepaliveTimeout?: NodeJS.Timeout;

src/lib/ClientWrapper.ts:20:22 - error TS4031: Public property 'keepaliveTimeout' of exported class has or is using private name 'NodeJS'.

20 keepaliveTimeout?: NodeJS.Timeout;


src/lib/ClientWrapper.ts:55:44 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`.

55     client.rtcpServer.on('message', (_buf: Buffer) => {

src/lib/ClientWrapper.ts:80:7 - error TS2304: Cannot find name 'clearTimeout'.

80 clearTimeout(this.keepaliveTimeout);


src/lib/ClientWrapper.ts:95:7 - error TS2304: Cannot find name 'clearTimeout'.

95       clearTimeout(this.keepaliveTimeout);

src/lib/ClientWrapper.ts:98:29 - error TS2304: Cannot find name 'setTimeout'.

98 this.keepaliveTimeout = setTimeout(async () => {


src/lib/Mount.ts:1:28 - error TS7016: Could not find a declaration file for module 'uuid'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/uuid/index.js' implicitly has an 'any' type.
  Try `npm install @types/uuid` if it exists or add a new declaration (.d.ts) file containing `declare module 'uuid';`

1 import { v4 as uuid } from 'uuid';

src/lib/Mount.ts:85:11 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'.

85 console.warn(Port error on ${e.port}, for stream ${stream.id} using another port);


src/lib/Mount.ts:93:13 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

93             console.log(e);

src/lib/Mount.ts:124:11 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'.

124 console.log('Closing Client', client.id);


src/lib/PublishServer.ts:1:23 - error TS7016: Could not find a declaration file for module 'basic-auth'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/basic-auth/index.js' implicitly has an 'any' type.
  Try `npm install @types/basic-auth` if it exists or add a new declaration (.d.ts) file containing `declare module 'basic-auth';`

1 import { parse } from 'basic-auth';

src/lib/PublishServer.ts:53:11 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the lib compiler option to include 'dom'.

53 console.error('Unknown PublishServer request', { method: req.method, url: req.url });


src/lib/PublishServer.ts:208:7 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.

208       console.error('Error setting up record request', e);

src/lib/RtpUdp.ts:1:38 - error TS2307: Cannot find module 'dgram'.

1 import { createSocket, Socket } from 'dgram';


src/lib/RtpUdp.ts:20:37 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`.

20     this.server.on('message', (buf: Buffer) => {

src/lib/utils.ts:1:34 - error TS7016: Could not find a declaration file for module 'debug'. '/Users/XXX/Desktop/rtsp-streaming-server/node_modules/debug/src/index.js' implicitly has an 'any' type. Try npm install @types/debug if it exists or add a new declaration (.d.ts) file containing declare module 'debug';

1 import debug, { IDebugger } from 'debug';


src/lib/utils.ts:2:21 - error TS2307: Cannot find module 'url'.

2 import { URL } from 'url';

types/rtsp-server.d.ts:2:32 - error TS2307: Cannot find module 'events'.

2 import { EventEmitter } from 'events';


types/rtsp-server.d.ts:3:26 - error TS2307: Cannot find module 'net'.

3   import { Socket } from 'net';

types/rtsp-server.d.ts:16:42 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node.

16 on(event: 'data', callback: (buffer: Buffer) => void): void;


types/rtsp-server.d.ts:35:42 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`.

35     on(event: 'data', listener: (buffer: Buffer) => void): this;

Found 34 errors.

npm ERR! code 1 npm ERR! path /Users/XXX/Desktop/rtsp-streaming-server npm ERR! command failed npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in: npm ERR! /Users/XXX/.npm/_logs/2022-02-28T07_11_12_204Z-debug-0.log