Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Unmet Peer Dependency typescript@>=1.6.2 #815

Closed
gclifford opened this issue Nov 22, 2015 · 43 comments
Closed

Unmet Peer Dependency typescript@>=1.6.2 #815

gclifford opened this issue Nov 22, 2015 · 43 comments

Comments

@gclifford
Copy link

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?

@adidahiya
Copy link
Contributor

adidahiya commented Nov 23, 2015

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

@gclifford
Copy link
Author

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.

@leonyu
Copy link

leonyu commented Nov 23, 2015

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
└── typescript@1.6.2

leonyu-workstation:~$ npm install tslint -g
/Users/leonyu/hihi/bin/tslint -> /Users/leonyu/hihi/lib/node_modules/tslint/bin/tslint
/Users/leonyu/hihi/lib
├─┬ tslint@3.0.0
│ ├─┬ findup-sync@0.2.1
│ │ └─┬ glob@4.3.5
│ │   ├─┬ inflight@1.0.4
│ │   │ └── wrappy@1.0.1
│ │   ├── inherits@2.0.1
│ │   ├─┬ minimatch@2.0.10
│ │   │ └─┬ brace-expansion@1.1.1
│ │   │   ├── balanced-match@0.2.1
│ │   │   └── concat-map@0.0.1
│ │   └── once@1.3.3
│ ├─┬ optimist@0.6.1
│ │ ├── minimist@0.0.10
│ │ └── wordwrap@0.0.3
│ └── underscore.string@3.1.1
└── UNMET PEER DEPENDENCY typescript@>=1.6.2

npm WARN EPEERINVALID tslint@3.0.0 requires a peer of typescript@>=1.6.2 but none was installed.
leonyu-workstation:~$

@adidahiya
Copy link
Contributor

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).

@gclifford
Copy link
Author

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.

@helios1138
Copy link

also having the same problem

@myitcv
Copy link
Contributor

myitcv commented Nov 24, 2015

@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 tslint@3.0.0
npm WARN install Couldn't install optional dependency: Unsupported
typescript_test@1.0.0 /home/myitcv/tmp/typescript_test
├── tslint@3.0.0
└── UNMET PEER DEPENDENCY typescript@1.8.0-dev.20151124

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?

@adidahiya
Copy link
Contributor

@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

@helios1138
Copy link

@adidahiya but this happening with current stable typescript release

@adidahiya
Copy link
Contributor

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

@myitcv
Copy link
Contributor

myitcv commented Nov 24, 2015

@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 👍

@adidahiya
Copy link
Contributor

@gclifford @helios1138 can you try running npm cache clean before installing? Might be related to this issue: npm/npm#10365

@luchillo17
Copy link

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 lodash@2.4.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.
npm WARN gulp-tslint@4.1.0 requires a peer of tslint@^3 || >=3.1.0-dev but none was installed.
npm WARN ionic-project@1.1.1 No repository field.
npm WARN ionic-project@1.1.1 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 gulp-tslint@3.x that resolves to 3.6.0 it works so it should be a problem with repository of gulp-tslint.

@adidahiya
Copy link
Contributor

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

@luchillo17
Copy link

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?

@adidahiya
Copy link
Contributor

@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/

@luchillo17
Copy link

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 tslint@3.1.1 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
└── typescript@1.7.3 

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
├── tslint@3.1.1 
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN tslint@3.1.1 requires a peer of typescript@>=1.7.3 but none was installed.
npm WARN In tslint@3.1.1 replacing bundled version of findup-sync with findup-sync@0.2.1
npm WARN In tslint@3.1.1 replacing bundled version of optimist with optimist@0.6.1
npm WARN In tslint@3.1.1 replacing bundled version of underscore.string with underscore.string@3.1.1
npm WARN In tslint@3.1.1 replacing bundled version of glob with glob@4.3.5
npm WARN In tslint@3.1.1 replacing bundled version of once with once@1.3.3
npm WARN In tslint@3.1.1 replacing bundled version of inherits with inherits@2.0.1
npm WARN In tslint@3.1.1 replacing bundled version of inflight with inflight@1.0.4
npm WARN In tslint@3.1.1 replacing bundled version of minimatch with minimatch@2.0.10
npm WARN In tslint@3.1.1 replacing bundled version of wrappy with wrappy@1.0.1
npm WARN In tslint@3.1.1 replacing bundled version of brace-expansion with brace-expansion@1.1.2
npm WARN In tslint@3.1.1 replacing bundled version of concat-map with concat-map@0.0.1
npm WARN In tslint@3.1.1 replacing bundled version of balanced-match with balanced-match@0.3.0
npm WARN In tslint@3.1.1 replacing bundled version of wordwrap with wordwrap@0.0.3
npm WARN In tslint@3.1.1 replacing bundled version of minimist with minimist@0.0.10

@adidahiya
Copy link
Contributor

@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?

@ArgTang
Copy link

ArgTang commented Dec 19, 2015

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

npm ls -g
├── tslint@3.2.1
├── typescript@1.7.5

when installing
npm WARN EPEERINVALID tslint@3.2.1 requires a peer of typescript@>=1.7.3 but none was installed.

@bartvanderwal
Copy link

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.

├── typescript@1.7.5 extraneous   <---
├── underscore@1.8.3
├── web3@0.13.0
└── web3plus@1.1.2 (git+https://4c2b0edc3e30fscrambled:x-oauth-basic@github.com/company/project/.git#f9fscrambled101)

npm ERR! extraneous: typescript@1.7.5 C:\Code\project\node_modules\typescript
npm ERR! peer dep missing: kerberos@~0.0, required by mongodb-core@1.2.30

C:\Code\project>npm uninstall typescript
- typescript@1.7.5 node_modules\typescript
project@1.0.0 C:\Code\project\
├── gulp@3.9.0
├── gulp-mocha@2.2.0
├── gulp-typescript@2.10.0
└── UNMET PEER DEPENDENCY typescript@>=1.7.3   <---

npm WARN mongodb-core@1.2.30 requires a peer of kerberos@~0.0 but none was installed.
npm WARN tslint@3.2.1 requires a peer of typescript@>=1.7.3 but none was installed.

C:\Code\project/>

@simonh1000
Copy link

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
└── typescript@1.7.5 

sim@sim-desktop:~/code/btsync/HTML/refugees$ sudo npm install -g tslint
/usr/bin/tslint -> /usr/lib/node_modules/tslint/bin/tslint
/usr/lib
├── tslint@3.3.0 
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN EPEERINVALID tslint@3.3.0 requires a peer of typescript@>=1.7.3 but none was installed.

@lorthirk
Copy link

lorthirk commented Mar 3, 2016

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
└── typescript@1.8.7


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
├── tslint@3.5.0
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN tslint@3.5.0 requires a peer of typescript@>=1.7.3 but none was installed.

@itrathnasekara
Copy link

I have the same issue on Win 8 with TypeScript 1.8.7

C:\Windows\system32>npm install -g tslint
C:\Users\indika\AppData\Roaming\npm\tslint -> C:\Users\indika\AppData\Roaming
npm\node_modules\tslint\bin\tslint
C:\Users\indika\AppData\Roaming\npm
├── tslint@3.5.0
└── UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN EPEERINVALID tslint@3.5.0 requires a peer of typescript@>=1.7.3 but non
e was installed.

@joshjhargreaves
Copy link

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

@metzger84
Copy link

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

@adidahiya
Copy link
Contributor

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

related: npm/npm#9857

@crtormen
Copy link

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

@rodri0315
Copy link

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

@Turbo87
Copy link

Turbo87 commented Aug 9, 2016

@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?

@adidahiya
Copy link
Contributor

@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?

@Turbo87
Copy link

Turbo87 commented Aug 9, 2016

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?

@jkillian
Copy link
Contributor

@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.

@Turbo87
Copy link

Turbo87 commented Aug 10, 2016

@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?

@jkillian
Copy link
Contributor

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.

@Turbo87
Copy link

Turbo87 commented Aug 11, 2016

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... 😉

@jkillian
Copy link
Contributor

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.

@donaldpipowitch
Copy link
Contributor

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

@lbialy
Copy link

lbialy commented Aug 12, 2016

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

@almothafar
Copy link

+1

+-- tslint@3.15.1
`-- UNMET PEER DEPENDENCY typescript@>=1.7.3

npm WARN tslint@3.15.1 requires a peer of typescript@>=1.7.3 but none was installed.

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

@airstep
Copy link

airstep commented Aug 26, 2016

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 tslint@3.15.1 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?

@Glavin001
Copy link
Contributor

Glavin001 commented Sep 5, 2016

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"
  },

@jkillian
Copy link
Contributor

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

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests