Hey, I have been trying to use this language server with nvim LSP. I cannot get the stylelint-lsp command to run, since the tslib dependency does not seem to be installed.
$ npm i -g stylelint-lsp
$ stylelint-lsp
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'tslib'
Require stack:
- /home/grzegorz/.nvm/versions/node/v12.20.1/lib/node_modules/stylelint-lsp/dist/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/grzegorz/.nvm/versions/node/v12.20.1/lib/node_modules/stylelint-lsp/dist/index.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/grzegorz/.nvm/versions/node/v12.20.1/lib/node_modules/stylelint-lsp/dist/index.js'
]
}
It works fine after I install tslib globally with npm i -g tslib.
I see the project uses yarn.lock, so I presume that it works well when using yarn to install the package globally. I reckon it may be worth it to provide installation instructions for npm/yarn in the README to highlight this issue, or change the repository in some way so that tslib is automatically installed.
npm & node version
$ node -v
v12.20.1
$ npm -v
6.14.11
Additional information
I tried cloning the repository and running npm install. I see that the prepare script failed:
Installation logs
```
✔ ~/projects/open-source/stylelint-lsp-npm [stylelint-lsp-npm L|✔]
09:37 $ npm i
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
> husky@4.2.5 install /home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/husky
> node husky install
husky > Setting up git hooks
husky > Done
> husky@4.2.5 postinstall /home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/husky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
> stylelint-lsp@1.2.0 prepare /home/grzegorz/projects/open-source/stylelint-lsp-npm
> run-s clean build
> stylelint-lsp@1.2.0 clean /home/grzegorz/projects/open-source/stylelint-lsp-npm
> rimraf dist
> stylelint-lsp@1.2.0 build /home/grzegorz/projects/open-source/stylelint-lsp-npm
> tsc -p tsconfig.build.json
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:5:58 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyPrepareParams'.
5 onPrepare(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:5:95 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyItem'.
5 onPrepare(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:6:64 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyIncomingCallsParams'.
6 onIncomingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:6:107 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyIncomingCall'.
6 onIncomingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:6:152 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyIncomingCall'.
6 onIncomingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:7:64 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyOutgoingCallsParams'.
7 onOutgoingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:7:107 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyOutgoingCall'.
7 onOutgoingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:7:152 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyOutgoingCall'.
7 onOutgoingCalls(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:3:557 - error TS2305: Module '"../../vscode-languageserver-protocol/lib/common/api"' has no exported member 'RPCMessageType'.
3 import { TextDocumentContentChangeEvent, TextDocumentSaveReason, Location, Command, TextEdit, WorkspaceEdit, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, DocumentHighlight, SymbolInformation, DocumentSymbol, WorkspaceSymbolParams, DocumentSymbolParams, CodeLens, DocumentLink, Range, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, StarRequestHandler, HandlerResult, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, StarNotificationHandler, RPCMessageType, MessageReader, MessageWriter, CancellationToken, Disposable, Event, ConnectionStrategy, InitializeParams, InitializeResult, InitializeError, InitializedParams, MessageActionItem, DidChangeConfigurationParams, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidSaveTextDocumentParams, WillSaveTextDocumentParams, DidChangeWatchedFilesParams, PublishDiagnosticsParams, CompletionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, ExecuteCommandParams, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, ClientCapabilities, ServerCapabilities, DocumentColorParams, ColorInformation, ColorPresentationParams, ColorPresentation, CodeAction, FoldingRangeParams, FoldingRange, Declaration, DeclarationLink, DefinitionLink, SelectionRange, SelectionRangeParams, ProgressType, HoverParams, SignatureHelpParams, DefinitionParams, DocumentHighlightParams, PrepareRenameParams, DeclarationParams, TypeDefinitionParams, ImplementationParams, WorkDoneProgressParams, PartialResultParams } from 'vscode-languageserver-protocol';
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:260:19 - error TS2315: Type 'NotificationType0' is not generic.
260 add(type: NotificationType0, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:261:22 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
261 add
(type: NotificationType
, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:267:25 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
267 add(type: RequestType0, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:268:28 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s).
268 add
(type: RequestType
, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:304:24 - error TS2315: Type 'NotificationType0' is not generic.
304 register(type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:305:27 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
305 register
(type: NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:313:61 - error TS2315: Type 'NotificationType0' is not generic.
313 register(unregisteration: BulkUnregistration, type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:314:64 - error TS2314: Generic type 'NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:418:31 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
418 onRequest(type: RequestType0, handler: RequestHandler0): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:419:34 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s).
419 onRequest
(type: RequestType
, handler: RequestHandler
): void;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:439:33 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
439 sendRequest(type: RequestType0, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:440:36 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s).
440 sendRequest
(type: RequestType
, params: P, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:455:30 - error TS2315: Type 'NotificationType0' is not generic.
455 onNotification(type: NotificationType0, handler: NotificationHandler0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:456:33 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
456 onNotification
(type: NotificationType
, handler: NotificationHandler
): void;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:476:32 - error TS2315: Type 'NotificationType0' is not generic.
476 sendNotification(type: NotificationType0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:477:35 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
477 sendNotification
(type: NotificationType
, params: P): void;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:51 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensParams'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:82 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:107 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsParams'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:123 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:148 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:192 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensRangeParams'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:117 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:23:23 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
23 build(): Proposed.SemanticTokens;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:28 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:54 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:9:3 - error TS2459: Module '"../node_modules/vscode-languageserver/lib/main"' declares 'RPCMessageType' locally, but it is not exported.
9 RPCMessageType,
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:3:557
3 import { TextDocumentContentChangeEvent, TextDocumentSaveReason, Location, Command, TextEdit, WorkspaceEdit, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, DocumentHighlight, SymbolInformation, DocumentSymbol, WorkspaceSymbolParams, DocumentSymbolParams, CodeLens, DocumentLink, Range, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, StarRequestHandler, HandlerResult, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, StarNotificationHandler, RPCMessageType, MessageReader, MessageWriter, CancellationToken, Disposable, Event, ConnectionStrategy, InitializeParams, InitializeResult, InitializeError, InitializedParams, MessageActionItem, DidChangeConfigurationParams, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidSaveTextDocumentParams, WillSaveTextDocumentParams, DidChangeWatchedFilesParams, PublishDiagnosticsParams, CompletionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, ExecuteCommandParams, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, ClientCapabilities, ServerCapabilities, DocumentColorParams, ColorInformation, ColorPresentationParams, ColorPresentation, CodeAction, FoldingRangeParams, FoldingRange, Declaration, DeclarationLink, DefinitionLink, SelectionRange, SelectionRangeParams, ProgressType, HoverParams, SignatureHelpParams, DefinitionParams, DocumentHighlightParams, PrepareRenameParams, DeclarationParams, TypeDefinitionParams, ImplementationParams, WorkDoneProgressParams, PartialResultParams } from 'vscode-languageserver-protocol';
~~~~~~~~~~~~~~
'RPCMessageType' is declared here.
src/buffered-message-queue.ts:145:11 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s).
145 type: RequestType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:150:38 - error TS7006: Parameter 'param' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:150:45 - error TS7006: Parameter 'token' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:181:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
181 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:186:42 - error TS7006: Parameter 'param' implicitly has an 'any' type.
186 this.connection.onNotification(type, param => {
~~~~~
src/buffered-message-queue.ts:204:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s).
204 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:244:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
244 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:264:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
264 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/index.ts:79:47 - error TS2558: Expected 1 type arguments, but got 2.
79 const exitNotification = new NotificationType<[number, string?], void>(
~~~~~~~~~~~~~~~~~~~~~~~
src/validate.ts:33:3 - error TS2558: Expected 1 type arguments, but got 2.
33 VersionedTextDocumentIdentifier,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 void
~~~~~~
src/validate.ts:184:38 - error TS2571: Object is of type 'unknown'.
184 const document = documents.get(identifier.uri)
~~~~~~~~~~
src/validate.ts:199:19 - error TS2571: Object is of type 'unknown'.
199 (document) => document.version
~~~~~~~~
Found 56 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! stylelint-lsp@1.2.0 build: `tsc -p tsconfig.build.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 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/grzegorz/.npm/_logs/2021-04-22T07_37_38_445Z-debug.log
ERROR: "build" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stylelint-lsp@1.2.0 prepare: `run-s clean build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 prepare 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/grzegorz/.npm/_logs/2021-04-22T07_37_38_503Z-debug.log
```
There are no issues when installing with yarn. I have compared the versions of packages installed by npm and yarn (in development mode, not --production) and in both, the tslib package is installed because of:
Both top-level lint-staged and @typescript-eslint are not installed in --production, so the tslib package is not installed at all, neither by npm or yarn.
The interesting thing to me is that dist/index.js begins by requiring tslib:
This leads me to think that either tslib should be somehow installed automatically, or be marked as a peerDependency, or importHelpers should be false. I believe the last option is the most sensible here, so I'll raise a PR shortly setting the option off, if you don't mind
Hey, I have been trying to use this language server with nvim LSP. I cannot get the
stylelint-lsp
command to run, since thetslib
dependency does not seem to be installed.It works fine after I install
tslib
globally withnpm i -g tslib
.I see the project uses
yarn.lock
, so I presume that it works well when usingyarn
to install the package globally. I reckon it may be worth it to provide installation instructions for npm/yarn in the README to highlight this issue, or change the repository in some way so thattslib
is automatically installed.npm & node version
Additional information
I tried cloning the repository and running
npm install
. I see that theprepare
script failed:Installation logs
``` ✔ ~/projects/open-source/stylelint-lsp-npm [stylelint-lsp-npm L|✔] 09:37 $ npm i npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated > husky@4.2.5 install /home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/husky > node husky install husky > Setting up git hooks husky > Done > husky@4.2.5 postinstall /home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/husky > opencollective-postinstall || exit 0 Thank you for using husky! If you rely on this package, please consider supporting our open collective: > https://opencollective.com/husky/donate > stylelint-lsp@1.2.0 prepare /home/grzegorz/projects/open-source/stylelint-lsp-npm > run-s clean build > stylelint-lsp@1.2.0 clean /home/grzegorz/projects/open-source/stylelint-lsp-npm > rimraf dist > stylelint-lsp@1.2.0 build /home/grzegorz/projects/open-source/stylelint-lsp-npm > tsc -p tsconfig.build.json node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:5:58 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyPrepareParams'. 5 onPrepare(handler: ServerRequestHandler' requires 1 type argument(s). 261 add
(type: NotificationType
, registerParams: RO): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:267:25 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
267 add(type: RequestType0, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:268:28 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 268 add
(type: RequestType
, registerParams: RO): void; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:304:24 - error TS2315: Type 'NotificationType0' is not generic. 304 register(type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:305:27 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 305 register
(type: NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:313:61 - error TS2315: Type 'NotificationType0' is not generic.
313 register(unregisteration: BulkUnregistration, type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:314:64 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 314 register
(unregisteration: BulkUnregistration, type: NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:321:30 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
321 register(type: RequestType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:322:33 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 322 register
(type: RequestType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:330:67 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
330 register(unregisteration: BulkUnregistration, type: RequestType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:331:70 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 331 register
(unregisteration: BulkUnregistration, type: RequestType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:418:31 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
418 onRequest(type: RequestType0, handler: RequestHandler0): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:419:34 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 419 onRequest
(type: RequestType
, handler: RequestHandler
): void; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:439:33 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
439 sendRequest(type: RequestType0, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:440:36 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 440 sendRequest
(type: RequestType
, params: P, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:455:30 - error TS2315: Type 'NotificationType0' is not generic.
455 onNotification(type: NotificationType0, handler: NotificationHandler0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:456:33 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 456 onNotification
(type: NotificationType
, handler: NotificationHandler
): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:476:32 - error TS2315: Type 'NotificationType0' is not generic. 476 sendNotification(type: NotificationType0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:477:35 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 477 sendNotification
(type: NotificationType
, params: P): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:51 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensParams'. 5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:82 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:107 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsParams'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:123 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:148 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:192 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensRangeParams'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:117 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:23:23 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
23 build(): Proposed.SemanticTokens;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:28 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:54 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp-npm/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:9:3 - error TS2459: Module '"../node_modules/vscode-languageserver/lib/main"' declares 'RPCMessageType' locally, but it is not exported.
9 RPCMessageType,
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:3:557
3 import { TextDocumentContentChangeEvent, TextDocumentSaveReason, Location, Command, TextEdit, WorkspaceEdit, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, DocumentHighlight, SymbolInformation, DocumentSymbol, WorkspaceSymbolParams, DocumentSymbolParams, CodeLens, DocumentLink, Range, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, StarRequestHandler, HandlerResult, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, StarNotificationHandler, RPCMessageType, MessageReader, MessageWriter, CancellationToken, Disposable, Event, ConnectionStrategy, InitializeParams, InitializeResult, InitializeError, InitializedParams, MessageActionItem, DidChangeConfigurationParams, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidSaveTextDocumentParams, WillSaveTextDocumentParams, DidChangeWatchedFilesParams, PublishDiagnosticsParams, CompletionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, ExecuteCommandParams, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, ClientCapabilities, ServerCapabilities, DocumentColorParams, ColorInformation, ColorPresentationParams, ColorPresentation, CodeAction, FoldingRangeParams, FoldingRange, Declaration, DeclarationLink, DefinitionLink, SelectionRange, SelectionRangeParams, ProgressType, HoverParams, SignatureHelpParams, DefinitionParams, DocumentHighlightParams, PrepareRenameParams, DeclarationParams, TypeDefinitionParams, ImplementationParams, WorkDoneProgressParams, PartialResultParams } from 'vscode-languageserver-protocol';
~~~~~~~~~~~~~~
'RPCMessageType' is declared here.
src/buffered-message-queue.ts:145:11 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 145 type: RequestType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:150:38 - error TS7006: Parameter 'param' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:150:45 - error TS7006: Parameter 'token' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:181:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 181 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:186:42 - error TS7006: Parameter 'param' implicitly has an 'any' type.
186 this.connection.onNotification(type, param => {
~~~~~
src/buffered-message-queue.ts:204:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 204 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:244:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
244 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:264:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
264 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/index.ts:79:47 - error TS2558: Expected 1 type arguments, but got 2.
79 const exitNotification = new NotificationType<[number, string?], void>(
~~~~~~~~~~~~~~~~~~~~~~~
src/validate.ts:33:3 - error TS2558: Expected 1 type arguments, but got 2.
33 VersionedTextDocumentIdentifier,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 void
~~~~~~
src/validate.ts:184:38 - error TS2571: Object is of type 'unknown'.
184 const document = documents.get(identifier.uri)
~~~~~~~~~~
src/validate.ts:199:19 - error TS2571: Object is of type 'unknown'.
199 (document) => document.version
~~~~~~~~
Found 56 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! stylelint-lsp@1.2.0 build: `tsc -p tsconfig.build.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 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/grzegorz/.npm/_logs/2021-04-22T07_37_38_445Z-debug.log
ERROR: "build" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stylelint-lsp@1.2.0 prepare: `run-s clean build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 prepare 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/grzegorz/.npm/_logs/2021-04-22T07_37_38_503Z-debug.log
```
There are no issues when installing with
yarn
. I have compared the versions of packages installed bynpm
andyarn
(in development mode, not--production
) and in both, thetslib
package is installed because of:Both top-level
lint-staged
and@typescript-eslint
are not installed in--production
, so thetslib
package is not installed at all, neither by npm or yarn.The interesting thing to me is that
dist/index.js
begins by requiringtslib
:It is used as a helper for
import default
:And that happens because
importHelpers
is set totrue
intsconfig.json
:https://github.com/bmatcuk/stylelint-lsp/blob/dc3591d9b848306d8662de7fe40dd2d0a90a64d6/tsconfig.json#L12
This leads me to think that either
tslib
should be somehow installed automatically, or be marked as apeerDependency
, orimportHelpers
should befalse
. I believe the last option is the most sensible here, so I'll raise a PR shortly setting the option off, if you don't mind