121

i clone a project with git, the project was create with ionic 2 but when i execute the command for re-create the node_modules folder i get this error.

npm install
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
npm ERR! code ETARGET
npm ERR! notarget No matching version found for ionic-native@^3.5.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'ionic-hello-world'
npm ERR! notarget 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wihermes/.npm/_logs/2017-06-02T13_58_47_295Z-debug.log

NOTE: I already update npm.

Does anyone know how to fix it?

Peter Reid
  • 5,139
  • 2
  • 37
  • 33
Daniela Romero
  • 1,421
  • 2
  • 10
  • 13
  • 1
    Same problem now after `npm install -g ionic@latest` which takes it up to v.3.12.0 ... npm complains that there "is no matching version found", but it's clearly installed. Worked to change `package.json` to target `"^3.0.0" and then let it install whatever it wanted to. That apparently worked, but it only installed 3.10.3. No idea why the difference, but meh. – mc01 Oct 01 '17 at 16:56

19 Answers19

171

I was having issue for a package which was available. Force cleaning the cache helped.

npm cache clean --force
Brij
  • 11,731
  • 22
  • 78
  • 116
  • 2
    Helped as well. Seems like a corrupted cache is the most likely reason for this error on npm v7. – silverwind May 17 '21 at 10:01
  • Use **sudo** before the command. – Jafar Amini Oct 01 '21 at 14:40
  • 2
    I have npm 8.1.2 and was trying to install newer version of angualr cli, got an error saying "No matching version found for debug@4.3.3.". This command helped. – Janet Dec 27 '21 at 16:39
  • I'm just wondering, why this possible solution could not be mentioned in npm error log alongside with 'no matching version'? Everyone knows that there is a matching version almost always and just trying to randomly figure it out. And everyone knows that cache cleaning will highly likely resolve the problem. – maveriq Feb 11 '22 at 11:59
  • 3
    Without `--force` I got the message: `As of npm@5, the npm cache self-heals from corruption issues by treating integrity mismatches as cache misses. As a result, data extracted from the cache is guaranteed to be valid.` But the problem was still fixed by forcing a cache clean! So much for the bold statements in the warning. – Holger Ludvigsen Sep 16 '22 at 12:01
  • For me, just `npm cache verify` seems to have helped. (Even though its output did not signal anything like a problem would have been found.) – Mormegil Aug 04 '23 at 10:25
79

The version you have specified, or one of your dependencies has specified is not published to npmjs.com

Executing npm view ionic-native versions (see docs) the following output is returned for package versions:

versions:
   [ '1.0.7',
     '1.0.8',
     '1.0.9',
     '1.0.10',
     '1.0.11',
     '1.0.12',
     '1.1.0',
     '1.1.1',
     '1.2.0',
     '1.2.1',
     '1.2.2',
     '1.2.3',
     '1.2.4',
     '1.3.0',
     '1.3.1',
     '1.3.2',
     '1.3.3',
     '1.3.4',
     '1.3.5',
     '1.3.6',
     '1.3.7',
     '1.3.8',
     '1.3.9',
     '1.3.10',
     '1.3.11',
     '1.3.12',
     '1.3.13',
     '1.3.14',
     '1.3.15',
     '1.3.16',
     '1.3.17',
     '1.3.18',
     '1.3.19',
     '1.3.20',
     '1.3.21',
     '1.3.22',
     '1.3.23',
     '1.3.24',
     '1.3.25',
     '1.3.26',
     '1.3.27',
     '2.0.0',
     '2.0.1',
     '2.0.2',
     '2.0.3',
     '2.1.2',
     '2.1.3',
     '2.1.4',
     '2.1.5',
     '2.1.6',
     '2.1.7',
     '2.1.8',
     '2.1.9',
     '2.2.0',
     '2.2.1',
     '2.2.2',
     '2.2.3',
     '2.2.4',
     '2.2.5',
     '2.2.6',
     '2.2.7',
     '2.2.8',
     '2.2.9',
     '2.2.10',
     '2.2.11',
     '2.2.12',
     '2.2.13',
     '2.2.14',
     '2.2.15',
     '2.2.16',
     '2.2.17',
     '2.3.0',
     '2.3.1',
     '2.3.2',
     '2.4.0',
     '2.4.1',
     '2.5.0',
     '2.5.1',
     '2.6.0',
     '2.7.0',
     '2.8.0',
     '2.8.1',
     '2.9.0' ],

As you can see no version higher than 2.9.0 has been published to the npm repository. Strangely they have versions higher than this on GitHub. I would suggest opening an issue with the maintainers on this.

For older versions of npm, the command may be npm view ionic-native (see legacy docs)

For now you can manually install the package via the tarball URL of the required release:

npm install https://github.com/ionic-team/ionic-native/tarball/v3.5.0
Peter Reid
  • 5,139
  • 2
  • 37
  • 33
  • Can you tell me about bp-datepicker , i can see version 5.0.6 is the latest but when i try to install it , it only installs 4.0.6 as the letest . – Master Yoda Aug 06 '19 at 08:55
  • Don't see how this relates back, open a new question please @MasterYoda – Peter Reid Aug 06 '19 at 09:57
  • 1
    We faced this issue in our organization when using Nexus for npm dependencies. The versions for packages were stale, so our workaround is to "Invalidate cache" on the Nexus repository. – trebor Oct 21 '19 at 20:50
  • As of npm v8, the command now seems to be `npm view ionic-native versions`. – Cameron Hudson Jun 06 '23 at 19:41
55

Try removing package-lock.json file first

BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
Olegas Gončarovas
  • 1,521
  • 1
  • 11
  • 16
  • 45
    This is no solution at all! Removing the lock file is like updating most packages to the latest known version. In worst case you have no tests within your project. Then you have to check every little functionality manually to verify everything still works fine. – Chilian Feb 22 '18 at 11:09
  • 1
    this worked for me whenI got a similar error after I changed the `name` in `package.json` – Nicolas R Mar 06 '18 at 23:07
  • 2
    I was trying to install a version that did exist. I confirmed it did exist using `npm view`. For some reason this worked for me. – GeorgeButter Aug 03 '18 at 03:28
  • It worked for me when I updated node and angular cli version. – Jimmy Feb 06 '19 at 06:02
17

Try removing package-lock.json and running npm install && npm update, it'll install the latest version and clear all errors.

BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
Lai Xue
  • 1,523
  • 1
  • 15
  • 17
  • 4
    Removing the lock file is like updating most packages to the latest known version, which may not help rather than create more errors by installing packages which are not backwards compatible – Rohit Kumar Oct 12 '22 at 10:33
5

In my case I was needed to do the following steps: The 1st step is outdated, so it could be skipped (most probably)

npm cache clean --force
npm cache verify
npm uninstall yourPackage
npm uninstall -g yourPackage

My problem is described here

After these steps the application was generated successfully.

Utmost Creator
  • 814
  • 1
  • 9
  • 21
4

To solve the issue:

Delete your package-lock.json or yarn.lock

Run npm cache clean --force

Then npm install or yarn install again.

Divin Irakiza
  • 317
  • 1
  • 7
2

Removing package-lock.json should be the last resort, at least for projects that have reached production status. After having the same error as described in this question, I found that my package-lock.json was corrupt, even though it was generated. One of the packages had itself as an empty dependency, in this example jsdoc:

        "jsdoc": {
        "version": "x.y.z",
        . . . . . . 
        "dependencies": {
            . . . . . ,
            "jsdoc": {},
            "taffydb": {
             . . . . . 

Please note I have omitted irrelevant parts of the code in this example.

I just removed the empty dependency "jsdoc": {}, and it was OK again.

Per Quested Aronsson
  • 11,380
  • 8
  • 54
  • 76
  • 1
    I had this too - even after running `npm install` with no `package-lock.json` ... Had to blow out `node_modules` and do another `npm install` to finally get this fixed – cloakedninjas Mar 15 '19 at 11:24
2

try

npm install --force
npm install --legacy-peer-deps
Aliti
  • 2,025
  • 2
  • 27
  • 39
1

Probably not the case of everybody but I had the same problem. I was using the last, in my case, the error was because I was using jfrog manage from the company where I am working.

 npm config list

The result was

; cli configs
metrics-registry = "https://COMPANYNAME.jfrog.io/COMPANYNAM/api/npm/npm/"
scope = ""
user-agent = "npm/6.3.0 node/v8.11.2 win32 x64"

; userconfig C:\Users\USER\.npmrc
always-auth = true
email = "XXXXXXXXX"
registry = "https://COMPANYNAME.jfrog.io/COMPANYNAME/api/npm/npm/"

; builtin config undefined
prefix = "C:\\Users\\XXXXX\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\WINDOWS\system32
; HOME = C:\Users\XXXXXX
; "npm config ls -l" to show all defaults.

I solve the problem by using the global metrics.

isaura almar
  • 406
  • 5
  • 11
1

For me the problem was that I issued the command:

npm publish dist

While this other command works:

npm publish dist/

The log was not intuitive.

Davide Calarco
  • 432
  • 4
  • 6
0

For those experimenting with creating their own packages, make sure that you dont skip a version. For instance, if I have published my-package 1.0.1 & 1.0.3, when I go to install it from elsewhere I will get an error notarget No matching version found for my-package@1.0.2.

The good news is it is fairly easy to fix, simply 'backfill' the empty version.

  1. edit package.json -> "version": "1.0.2"
  2. npm publish

EDIT: As suggested in comment, clearing the cache will solve the problem locally

  • npm cache clean --force
chantey
  • 4,252
  • 1
  • 35
  • 40
  • 1
    had the same situation, clearing the cache with `npm cache clean --force` did the trick as explained below from @Brij – birnchen7 Jul 22 '21 at 20:46
0

Haven't seen it mentionned yet, for me it was my project's .npmrc file that was pointing to the wrong npm registry, as we're using Azure DevOps Package Registry.

Laurent
  • 478
  • 7
  • 15
0

I and running a node app with nextjs on the frontend and nestjs on the backend.

What I did was to delete my pnpm-lock.yaml file from my project folder and I was able to get past this error. It did went ahead and re-create this file though.

Dwain B
  • 187
  • 1
  • 6
0

In my case, I was trying to install yarn@3, running npm view yarn showed version 3 isn't on npm.

Going to the yarn docs for version 3 showed the solution:

corepack prepare yarn@stable --activate
corepack prepare yarn@<version> --activate
Moshisho
  • 2,781
  • 1
  • 23
  • 39
0

coming from the future to add one point:

Thanks what other people mentioned we have:

  • you should try clearing cache npm cache clean --force
  • and view the versions npm view [pacakgeName] versions

What I wanted to add:

  • if it didn't work, check you registry npm config get registry and make sure it matches this https://registry.npmjs.org/

The last point was my problem, So wanted to mention it in case someone had same problem.

Ahmed Mansour
  • 500
  • 4
  • 14
0

Inside your package.json, delete "graphql": "^", and npm install after saving the changes

Komal
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 06 '23 at 15:01
-1

If none of this did not help, then try to swap ^ in "^version" to ~ "~version".

-1

first, in C:\users\your PC write npm uninstall -g create-react-app then, create your project folder with npx create-react-app folder-name.

Enrico Cortinovis
  • 811
  • 3
  • 8
  • 31
musa23
  • 1
-2

Remove node_modules, cache files (normally are at the top of the folder in your editor) and the package-lock.json, then run npm install.

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
Luis Lopez
  • 11
  • 1