Tslint: Unmet Peer Dependency typescript@>=1.6.2

Created on 22 Nov 2015  Β·  43Comments  Β·  Source: palantir/tslint

I am trying to install tslint 3.0.0 but it keeps saying "Unmet Peer Dependency typescript@>=1.6.2"

How do I get this to go away?

External Question

Most helpful comment

peer dependencies are not installed automatically by npm v3.x (they were automatic in 1.x and 2.x).

have you installed typescript alongside tslint?

Update

Pasting the "solution" here so you don't have to scroll to see it:

This is an NPM usability bug. The only solution is to install concurrently:

npm install -g tslint typescript

All 43 comments

peer dependencies are not installed automatically by npm v3.x (they were automatic in 1.x and 2.x).

have you installed typescript alongside tslint?

Update

Pasting the "solution" here so you don't have to scroll to see it:

This is an NPM usability bug. The only solution is to install concurrently:

npm install -g tslint typescript

I installed both tslint and typescript at the global level. Current typescript version 1.6.2

I am also trying to do this on Windows.

Getting the same problem on clean install on OSX using Brew distribution of nodejs.

This does not appear to happen on my CentOS box.

Here is to reproduce using custom prefix (so i don't need to blow away my existing modules):

leonyu-workstation:~$ npm config set prefix hihi
leonyu-workstation:~$ npm list -g


leonyu-workstation:~$ npm install typescript -g
/Users/leonyu/hihi/bin/tsc -> /Users/leonyu/hihi/lib/node_modules/typescript/bin/tsc
/Users/leonyu/hihi/bin/tsserver -> /Users/leonyu/hihi/lib/node_modules/typescript/bin/tsserver
/Users/leonyu/hihi/lib
└── [email protected]

leonyu-workstation:~$ npm install tslint -g
/Users/leonyu/hihi/bin/tslint -> /Users/leonyu/hihi/lib/node_modules/tslint/bin/tslint
/Users/leonyu/hihi/lib
β”œβ”€β”¬ [email protected]
β”‚ β”œβ”€β”¬ [email protected]
β”‚ β”‚ └─┬ [email protected]
β”‚ β”‚   β”œβ”€β”¬ [email protected]
β”‚ β”‚   β”‚ └── [email protected]
β”‚ β”‚   β”œβ”€β”€ [email protected]
β”‚ β”‚   β”œβ”€β”¬ [email protected]
β”‚ β”‚   β”‚ └─┬ [email protected]
β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
β”‚ β”‚   β”‚   └── [email protected]
β”‚ β”‚   └── [email protected]
β”‚ β”œβ”€β”¬ [email protected]
β”‚ β”‚ β”œβ”€β”€ [email protected]
β”‚ β”‚ └── [email protected]
β”‚ └── [email protected]
└── UNMET PEER DEPENDENCY typescript@>=1.6.2

npm WARN EPEERINVALID [email protected] requires a peer of typescript@>=1.6.2 but none was installed.
leonyu-workstation:~$

Is it just a warning that's produced here? Or is your global tslint actually not working if you try to run it? This may be an NPM bug (false positive warning from them).

After playing with it for a bit, it seems like tslint is working fine. Might be an npm bug. I will provide more info after some more tests.

also having the same problem

@adidahiya worth noting that tslint v3.0.0 has the peerDepedency listed as:

  "peerDependencies": {
    "typescript": ">=1.6.2"
  }

which means that if you are using a pre-release (or whatever term npm uses) version of TypeScript it considers the peer dependency not to have been met:

$ npm install --save-dev [email protected]
npm WARN install Couldn't install optional dependency: Unsupported
[email protected] /home/myitcv/tmp/typescript_test
β”œβ”€β”€ [email protected]
└── UNMET PEER DEPENDENCY [email protected]

However, the next branch (which is a number of commits behind v3.0.0) has the following:

  "peerDependencies": {
    "typescript": ">=1.7.0 || >=1.7.0-dev.20151003 || >=1.8.0-dev"
  }

which is perfectly happy with the pre-release version.

Again, this warning can simply be ignored. But worth noting for those people now trying to install 3.0.0 against a next version of TypeScript.

Unless you're happy including the pre-release peer dependency options in main releases of tslint? Any harm in doing this?

@myitcv yeah we thought about this a little bit... I'd prefer to keep tslint stable releases tied to typescript's stable releases, and if users want next functionality, they ought to use the next distribution of both libraries

@adidahiya but this happening with current stable typescript release

@helios1138 it's just an error though, right? does your tslint binary work despite the error? are you installing globally? need some more info...

@helios1138 - if you are installing both globally, this is likely an npm issue as has been mentioned in other posts in the thread.

@adidahiya understood. Look forward to the next distribution for tslint being updated :+1:

@gclifford @helios1138 can you try running npm cache clean before installing? Might be related to this issue: https://github.com/npm/npm/issues/10365

I'm having some problem with it, npm gives me that warning when installing, it doesn't with gulp-tslint@latest, but in both cases when trying to use it then shows an error like:

aplicaciones2@MacBook-Pro-de-aplicacioes-2:~/Documents/Programming/OSGroup/taoappionic$ npm i --save gulp-tslint@latest
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.
npm WARN [email protected] requires a peer of tslint@^3 || >=3.1.0-dev but none was installed.
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
aplicaciones2@MacBook-Pro-de-aplicacioes-2:~/Documents/Programming/OSGroup/taoappionic$ gulp tslint
module.js:340
    throw err;
    ^

Error: Cannot find module 'tslint'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/aplicaciones2/Documents/Programming/OSGroup/taoappionic/node_modules/gulp-tslint/index.js:7:14)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

Any ideas how to fix even after npm cache clean?, if i install [email protected] that resolves to 3.6.0 it works so it should be a problem with repository of gulp-tslint.

@Luchillo looks like you only installed gulp-tslint and not tslint there

Did it get separated? why with v3.6.0 still works? as far as i understand gulp-tslint is a wrapper for tslint npm package, doesn't it?

@Luchillo no, it's not a wrapper, it's a gulp plugin. the latest gulp-tslint has tslint as a peer dependency, so tslint doesn't get installed automatically. you need to npm install both. https://nodejs.org/en/blog/npm/peer-dependencies/

Oh as i just used v3.6.0 before i didn't know about the change, but it should be installed in local project, global or both?

Also the peer dependency for [email protected] says unmet as well, even with typescript installed:

aplicaciones2@MacBook-Pro-de-aplicacioes-2:~/Documents/Programming/OSGroup/taoappionic$ npm i -g typescript
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/bin/tsserver -> /usr/local/lib/node_modules/typescript/bin/tsserver
/usr/local/lib
└── [email protected] 

aplicaciones2@MacBook-Pro-de-aplicacioes-2:~/Documents/Programming/OSGroup/taoappionic$ npm i -g tslint
/usr/local/bin/tslint -> /usr/local/lib/node_modules/tslint/bin/tslint
/usr/local/lib
β”œβ”€β”€ [email protected] 
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN [email protected] requires a peer of typescript@>=1.7.3 but none was installed.
npm WARN In [email protected] replacing bundled version of findup-sync with [email protected]
npm WARN In [email protected] replacing bundled version of optimist with [email protected]
npm WARN In [email protected] replacing bundled version of underscore.string with [email protected]
npm WARN In [email protected] replacing bundled version of glob with [email protected]
npm WARN In [email protected] replacing bundled version of once with [email protected]
npm WARN In [email protected] replacing bundled version of inherits with [email protected]
npm WARN In [email protected] replacing bundled version of inflight with [email protected]
npm WARN In [email protected] replacing bundled version of minimatch with [email protected]
npm WARN In [email protected] replacing bundled version of wrappy with [email protected]
npm WARN In [email protected] replacing bundled version of brace-expansion with [email protected]
npm WARN In [email protected] replacing bundled version of concat-map with [email protected]
npm WARN In [email protected] replacing bundled version of balanced-match with [email protected]
npm WARN In [email protected] replacing bundled version of wordwrap with [email protected]
npm WARN In [email protected] replacing bundled version of minimist with [email protected]

@Luchillo gulp-tslint has updated its version to 4.x, which means there are breaking changes from 3.x.

as for the "unmet peer dependency" warning, that's what the above thread is about -- I think it's an NPM bug. does it go away if you uninstall, run npm cache clean, and install again globally?

@adidahiya
Hi i get the same warning, even after npm cache clean
both are installed globally.

npm ls -g
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]

when installing
npm WARN EPEERINVALID [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

It's weird. It's either an UNMET PEER DEPENDENCY or extraneous, see below.

So you have to choose between two errors. If you really dislike capitalization you can do npm install typescript or even an npm install typescript --save-dev if you want to spare future colleagues these capitals. But I choose to uninstall again, since things were generally working okay.

β”œβ”€β”€ [email protected] extraneous   <---
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected] (git+https://4c2b0edc3e30fscrambled:[email protected]/company/project/.git#f9fscrambled101)

npm ERR! extraneous: [email protected] C:\Code\project\node_modules\typescript
npm ERR! peer dep missing: kerberos@~0.0, required by [email protected]

C:\Code\project>npm uninstall typescript
- [email protected] node_modules\typescript
[email protected] C:\Code\project\
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── UNMET PEER DEPENDENCY typescript@>=1.7.3   <---

npm WARN [email protected] requires a peer of kerberos@~0.0 but none was installed.
npm WARN [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

C:\Code\project/>

Same issue here with Ubuntu and npm 3.3.12

sim@sim-desktop:~/code/btsync/HTML/refugees$ sudo npm install -g typescript
/usr/bin/tsc -> /usr/lib/node_modules/typescript/bin/tsc
/usr/bin/tsserver -> /usr/lib/node_modules/typescript/bin/tsserver
/usr/lib
└── [email protected] 

sim@sim-desktop:~/code/btsync/HTML/refugees$ sudo npm install -g tslint
/usr/bin/tslint -> /usr/lib/node_modules/tslint/bin/tslint
/usr/lib
β”œβ”€β”€ [email protected] 
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN EPEERINVALID [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

Just wanted to report the same issue on Windows 10, node 5.7.1, npm 3.5.3 and typescript 1.8.7:

C:\Users\cmezzasalma\Sviluppo\SmartScarlett>npm install -g typescript
C:\Users\cmezzasalma\AppData\Roaming\npm\tsc -> C:\Users\cmezzasalma\AppData\Roaming\npm\node_modules\typescript\bin\tsc
C:\Users\cmezzasalma\AppData\Roaming\npm\tsserver -> C:\Users\cmezzasalma\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
C:\Users\cmezzasalma\AppData\Roaming\npm
└── [email protected]


C:\Users\cmezzasalma\Sviluppo\SmartScarlett>npm install -g tslint
C:\Users\cmezzasalma\AppData\Roaming\npm\tslint -> C:\Users\cmezzasalma\AppData\Roaming\npm\node_modules\tslint\bin\tslint
C:\Users\cmezzasalma\AppData\Roaming\npm
β”œβ”€β”€ [email protected]
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

I have the same issue on Win 8 with TypeScript 1.8.7

C:\Windows\system32>npm install -g tslint
C:\Users\indika\AppData\Roamingnpmtslint -> C:\Users\indika\AppData\Roaming\
npmnode_modulestslint\bintslint
C:\Users\indika\AppData\Roamingnpm
β”œβ”€β”€ [email protected]
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN EPEERINVALID [email protected] requires a peer of typescript@>=1.7.3 but non
e was installed.

Just chiming in to say I have the same issue on OSX with node v5.7.0 and npm 3.6.0

I've got the same issue on OS X with npm 3.7.3

I think this is an NPM usability bug, the only solution being to install the peers concurrently: npm install -g tslint typescript.

related: https://github.com/npm/npm/issues/9857

Installing them concurrently seems to work, none warn message! thank you @adidahiya

An update on this, I have this issue, with typescript Version 1.8.10.
npm WARN EPEERINVALID [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

@adidahiya it seems that tslint is currently not installable together with the typescript 2.1.0-dev release on NPM 2 due to the peer dependency failing (see #1401). is there a workaround for this other than forcing TravisCI (and our devs) to use NPM 3 for older Node releases?

@Turbo87 hmm, are you sure? This line seems to suggest that 2.1.0-dev would work: https://github.com/palantir/tslint/blob/next/package.json#L49. Do you know NPM v2 is doing differently here?

ah, so the thing is that we've been using the ^3.14.0-dev.0 constraint for tslint, but since 3.14.0 was released it satisfies the constraint and removed the relaxed peerDependency constraint on typescript again. was that intentional? are we doing something wrong here?

@Turbo87 It was intentional, although it's an unfortunate byproduct of how we do releases. Any release ending in -dev.x is a release designed to work with the latest prerelease versions of TS, specifically the 2.x line right now.

Any non -dev.x release is designed to work with typescript@latest, which is currently 1.8.10 right now.

If you want to depend on the most recent versions of TSLint that go with the most recent versions of TS, I'd recommend either depending on tslint@next or a single specific version of TSLint.

@JKillian thanks for the clarification! since peer dependencies are only informational in NPM v3 and are causing these unexpected issues in NPM v2 would it make sense to replace the peer dependency with a compatibility note in the README file instead?

Hmm, perhaps I misunderstand, but isn't your issue resolvable just by changing how you specify the dependency on TSLint? I'm hesitant to remove the peerDepedendency because, while mainly informational, it does represent the correct TS versions that each package is designed to work with.

isn't your issue resolvable just by changing how you specify the dependency on TSLint?

yes, pinning the dependency would solve the issue, but obviously we won't get any updates that way.

I'm hesitant to remove the peerDepedendency because, while mainly informational, it does represent the correct TS versions that each package is designed to work with.

two comments on that:

  • the problem is that it is in fact not just informational on NPM v2. if you want it to be just informational then it should be in the README instead. (the alternative is forcing users to use NPM v3, but since NPM v2 was shipped up to Node 4 this isn't really a great option)
  • you said that -dev is designed to work with TS-dev, while non-dev isn't, correct? but if non-dev is based on the dev versions then why wouldn't non-dev be designed to work with TS-dev too?

I'm fine with whatever you decide is the best solution, I'd just like to understand it... πŸ˜‰

We could even go as far as to publish in two different packages, but I feel like that's a pain for third-party libraries that integrate TSLint and for users.

you said that -dev is designed to work with TS-dev, while non-dev isn't, correct? but if non-dev is based on the dev versions then why wouldn't non-dev be designed to work with TS-dev too?

Well, the two versions are _mostly_ the same, but there may be they are a little bit diverging. The -dev versions contain bits of code that handle new language features correctly, and these bits of code wouldn't work with an older version of TS. These bits of code also aren't in the non-dev versions.

I'm worried if the peerDependency was removed, people would end up with non-compatible versions of TS and TSLint installed and not know what was going on. Things as they are right now aren't perfect either though as you correctly point out, so I'm unsure of the best solution.

It would be nice if @next would always be newer than @latest. Maybe this can just be automated by CI.

This also crashes npm shrinkwrap with typescript version ^1.9.0-dev required by @angular/compiler-cli and @angular/tsc-wrapped - ts 1.8.10 is too low for those packages and 1.9.0-dev causes invalid peer on tslint.

Edit: npm 3.10.x

+1

+-- [email protected]
`-- UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN [email protected] requires a peer of typescript@>=1.7.3 but none was installed.

C:\Windows\system32>tsc -v
Version 1.8.10

Can't start to work it together with vscode 1.4.0

sudo npm i tslint -g 
......
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN [email protected] requires a peer of typescript@>=1.7.3 but none was installed.
$ tslint --version
3.15.1

Error is appear at the top of vscode: Failed to load tslint library. Please install tslint in your workspace

Tried to set "tslint.enable": true|false (in userspace and workspace) - it didn't help.

$ npm --version
3.10.3

$ node --version
v6.4.0

Any advice?

I changed my package.json to use the following and it works now on Node v4 up to v6:

  "devDependencies": {
    "tslint": "3.15.0-dev.0",
    "typescript": "^2.1.0-dev.20160827"
  },

Closing this issue as it's an NPM issue and outside of our control

πŸ€– Beep boop! πŸ‘‰ TSLint is deprecated πŸ‘ˆ and you should switch to typescript-eslint! πŸ€–

πŸ”’ This issue is being locked to prevent further unnecessary discussions. Thank you! πŸ‘‹

Was this page helpful?
0 / 5 - 0 ratings