Add a Dist Tag in NPM

Add a Dist Tag in NPM
0

#1

Hello,

I have an error after I try to add a dist-tag to npm. Could you help me with that.

I create the package.json as follow:
cat package.json
{
“name”: “fcc”,
“version”: “1.1.2”,
“description”: “Free Code Camp Project Test”,
“main”: “index.js”,
“scripts”: {
“test”: “node test.js”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/newdygo/fcc.git”
},
“keywords”: [
“test”
],
“author”: “newdygo”,
“license”: “ISC”,
“bugs”: {
“url”: “https://github.com/newdygo/fcc/issues
},
“homepage”: “https://github.com/newdygo/fcc#readme”,
“dependencies”: {
"@linclark/pkg": “^1.0.2”
},
“devDependencies”: {}
}

The module is published and I try to add a dist-tag like this:

npm dist-tag add fcc@1.1.2 [beta]

I get an error after that.

npm ERR! Linux 4.2.0-c9
npm ERR! argv “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node” “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm” “dist-tag” “add” “fcc@1.1.2” "[beta]"
npm ERR! node v4.4.5
npm ERR! npm v3.10.5
npm ERR! code E404

npm ERR! 404 missing : -/package/fcc/dist-tags

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/ionit/npm-debug.log

Anyone knows what’s is going on?

Thanks.
Diego Balduino


#2

I had this exact problem yesterday and wasted several hours chasing it down. Here’s what I found and did.

dhcodes’ solution (GitHub) worked for me.

Go back and redo the Start A Project step and npm init. Verify.
(This should now insert your username before your package name: @newdygo/fcc - for some reason the first time fails to do that.)

Then go back to the Publish step and redo that. Verify.

Then redo the Version step, incrementing as per the instructions. Verify.

Now Publish again (making the new version live).

Now try adding your tag.

If you have trouble with the removing tag step, as I did, I posted a step-by-step workaround for that here.

Good luck.


#3

Did you have any luck, or did I write that for nothing?


#4

I tried your approach three times.
It works during the third time :slight_smile:

You help so much.

Thanks.


#5

Oh good, thanks for letting us know :smiley:


#6

Yep, in my case Publishing again and then adding the tag did the trick (because my package had the correct name)


#7

This does not appear to work for me. I will have to come to this project later when its fixed.


#8

I deleted everything and did the whole project up to that point and it worked. https://github.com/npm/how-to-npm/issues/21 the user “tdbs” suggests that if you do something wrong its hard to get it back to a working state. So I started over and that worked.

  1. deleted the project folder
  2. Went through the whole process again remembering to verify the already verified steps.

#9

I’m confused. I thought I added multiple tags. My latest published version was 2.0.3. I successfully added the tag 2.0.2 (or so I thought). I then ran the verify command and it said I still only had one tag.


#10

Here’s where I went wrong, and maybe this will help someone out…

The beginning of my package.json file:

{
“name”: “@jdkoeh/npmlesson”,
“version”: “1.0.1”,

The command I was getting an error from:

$ npm dist-tag add npmlesson@1.0.1 [betatest]

All I had to do to get it to work correctly was type out the full project name as it appears at the top of the package.json file like so:

$ npm dist-tag add @jdkoeh/npmlesson@1.0.1 [betatest]


#11

Thank you so much! That was exactly the information I needed to get it right.


#12

Hi thanks for this, I thought it was gonna work but then I run the ‘npm publish’ command and it takes a really long time. Then I get a really weird error message:

npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
npm ERR! Error: connect ECONNREFUSED 127.0.0.1:15443
npm ERR!     at Object.exports._errnoException (util.js:907:11)
npm ERR!     at exports._exceptionWithHostPort (util.js:930:20)
npm ERR!     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1077:14)
npm ERR!  { [Error: connect ECONNREFUSED 127.0.0.1:15443]
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '127.0.0.1',
npm ERR!   port: 15443 }
npm ERR! 
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

#14

@TheWhippinpost Thanks for the solution. It worked for me.


#15

I had this same bug. What I did is:

  1. npm ls //to find out my root dir is: @gooretzka/char-example@2.0.3
  2. npm dist-tag add @gooretzka/chat-example@2.0.3 beta
    It worked.

#16

Okay guys, here is how I fixed the problem. Everyone has you thinking you’re typing your code wrong, and maybe so, but there is one other thing you need to know: updating your version properly.

  1. Type npm version and look at the first line to find out the name and pkg version # that you’re dealing with.
    1a. Here was mine: @thelynguist/chat-example@1.2.3 (it actually looked more like:

        '@thelynguist/chat-example:' '1.2.3'
    

    …but that’s not how you’ll be typing it, so don’t worry about that)

  2. You MUST change this version number, and not how you may think.
    2a. In the “version” step (step 9), they say typing npm version will automatically update your version #, but it DOESN’T.
    2b. So, go up to your json file and manually update it to
    name: @thelynguist/chat-example
    version: 1.2.4.
    2c. DO NOT just save it. I tried and it didn’t work. You must also refresh your page after you save it.
    2d. This will update your version number (the thing it’s fussing about that nobody understands).

  3. NOW you can publish again: npm publish. Verify and continue.

  4. From here they also want you to add a “tag” (dist-tag) to this new published version.
    4a. thelynguist/chat-example@1.2.4 beta

It should work from there.

Somehow, we’re able to pass the “publish again” stage without really passing. That is, your version number has not been updated (at least, I passed, despite my number not being updated). So when you go to add the new tag, it doesn’t want to go through. That’s why dhcodes’ solution didn’t quite work for me, and possibly not for you either.


#17

Super helpful…Thanks