Git Product home page Git Product logo

Comments (30)

RandyDavis avatar RandyDavis commented on May 18, 2024 22

I was having pretty much all of the issues as everyone above and definitely was thinking that I was not doing something right and then I did the following and it worked:

  1. Enter "npm ls" command and hit enter to get the correct user and module names along with version number
  2. The first line it returns should be something like this @randy/[email protected] /home/ubuntu/workspace
  3. Take the part from the beginning through the version number and enter the following command: npm dist-tag add @randy/[email protected] test (test is the tag name)
  4. It should return +test: @randy/[email protected]
  5. Run how-to-npm verify command and it should pass

from how-to-npm.

 avatar commented on May 18, 2024 10

I had some problems with npm ls because it didn't list me out full name as @RandyDavis mentioned above. But there is solution for that.
Open your package.json file and look for name and version.
screenshot from 2016-10-24 15-48-04

Here you can see them on the beginning of package.json file.
And you write:
npm dist-tag add @dayfiri/[email protected] what

Where @dayfiri/dev_env is my name in package.json,
0.0.2 is version from package.json file also,
and what is [tag] name. Tag name is your choice what you wanna write.

from how-to-npm.

buck-yeh avatar buck-yeh commented on May 18, 2024 8

I just figured it out. Should have typed
npm dist-tag add @buck/[email protected] tttt
Instead, I typed
npm dist-tag add [email protected] tttt

from how-to-npm.

tdbs avatar tdbs commented on May 18, 2024 6

It seems once you get into the 404 erros there's not a simple way back, i tried init the project again, doing ls to see the correct name of the project, nothing worked, an entry level tutorial should not be this fragile, and its ridiculous this is closed.

from how-to-npm.

DougRiblet avatar DougRiblet commented on May 18, 2024 5

After a dozen failures, I got it to work by restarting the exercise and using 'npm dist-tag add @smashzen/[email protected] newt' (following the mckenna formula above).

from how-to-npm.

mpmckenna8 avatar mpmckenna8 commented on May 18, 2024 3

I was getting the same 404 error and couldn't figure out what was wrong because if typed as above it will work for regular modules but not in our how-to-npm dev environment.

To finally get it to work I used:
npm dist-tag add @mpmckenna8/[email protected] what

Where the reference to the module starts with the @username/moduleName/version and in this case the dist-tag to add is what. Making this syntax explicit in the lesson text would probably be useful.

from how-to-npm.

Deftwun avatar Deftwun commented on May 18, 2024 2

I couldn't get this to work either so I edited /.config/how-to-npm/registry/my_package_name/body.json and manually included my own tag in 'dist-tags' section. Then ran how-to-npm verify and it gave me a success message. I had to delete the tag and change the 'latest' version for the next challenge manually too. Not really a fix but at least it says completed now...

from how-to-npm.

magdalenagorecka avatar magdalenagorecka commented on May 18, 2024 1

I had this same bug. What I did is:

  1. npm ls //to find out my root dir is: @gooretzka/[email protected]
  2. npm dist-tag add @gooretzka/[email protected] beta
    It worked.

from how-to-npm.

coloradude avatar coloradude commented on May 18, 2024

I'm having issues with this one as well.

from how-to-npm.

buck-yeh avatar buck-yeh commented on May 18, 2024

Same here too!

from how-to-npm.

denmch avatar denmch commented on May 18, 2024

This actually does work. See this note on FreeCodeCamp's implementation of how-to-npm for details about the bug and how to avoid it: freeCodeCamp/freeCodeCamp#758

from how-to-npm.

gautammadaan avatar gautammadaan commented on May 18, 2024

@buck-yeh can you elaborate what was "buck" and "pkg" in your case? I am facing the same issue.

from how-to-npm.

denmch avatar denmch commented on May 18, 2024

@gautammadaan I spent some more time with this and narrowed it down. The real issue for most users experiencing problems with this portion of the tutorial is a misunderstanding of how versions are created and published and how dist-tags relate to them.

If you make a mistake, e.g., trying to apply a dist-tag to a version number that hasn't been published, the app throws up errors and ceases to work as expected. The solution is to run how-to-npm again and, if necessary, repeat the previous step (or steps).

In other words, you may need to go back two steps to use npm version patch (or similar) and note the version number. Then publish that version. Then use the correct syntax to add a dist-tag to the newly published version.

If you follow those steps the tutorial works perfectly. But it will continue to throw errors and fail to add dist-tags if you make a mistake or if you attempt to do certain actions on steps other than those on which they are being tested.

from how-to-npm.

gautammadaan avatar gautammadaan commented on May 18, 2024

@denmch Thanks a lot of that. Yes you are right! The part of the tutorial that didn't work for me was "npm publish" and so it was throwing up errors later on in the tutorial.

from how-to-npm.

denmch avatar denmch commented on May 18, 2024

I still consider this a bug, because npm dist-tag ls lists the erroneous dist tags even though they were invalid. And once you make this mistake, the dist-tag portion of the tutorial becomes unusable and how-to-npm must be restarted.

It looks to me that something is broken around the error messages, I see these errors related to dist tags in registry.js but they don't seem to come up when you commit the errors:

126:
return _403(req, res, { error: 'invalid version' })

137–9:
return _403(req, res, { error: 'You may not have a dist tag that is also a valid version' })

143–145:
return _403(req, res, { error: 'Tag points at invalid version: ' + dt + ' -> ' + ver })

from how-to-npm.

 avatar commented on May 18, 2024

I agree. I consider this about alsoJosh CSent from Yahoo Mail for iPhoneAt Jun 5, 2015, 5:06:12 PM, Den McHenry wrote:I still consider this a bug, because npm dist-tag ls lists the erroneous dist tags even though they were invalid. And once you make this mistake, the dist-tag portion of the tutorial becomes unusable and how-to-npm must be restarted.

It looks to me that something is broken around the error messages, I see these errors related to dist tags in registry.js but they don't seem to come up when you commit the errors:

126:
return _403(req, res, { error: 'invalid version' })

137–9:
return _403(req, res, {
error: 'You may not have a dist tag that is also a valid version'
})

143–145:
return _403(req, res, {
error: 'Tag points at invalid version: ' + dt + ' -> ' + ver
})

—Reply to this email directly or view it on GitHub.

from how-to-npm.

leepowelldev avatar leepowelldev commented on May 18, 2024

+1
This part of the tutorial is very confusing and doesn't do much to help explain how to use dist-tag effectively. I'm sure others have got it to work, but I couldn't.

from how-to-npm.

jfmaggie avatar jfmaggie commented on May 18, 2024

I am having the same problem here. Tried repeat last two steps and avoid any irrelevant command, still no luck.

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/Users/Maggie/npm-global/bin/npm', 'dist-tag', 'ls' ]
2 info using [email protected]
3 info using [email protected]
4 silly mapToRegistry name xiaojingling
5 silly mapToRegistry using default registry
6 silly mapToRegistry registry http://localhost:15443/
7 silly mapToRegistry uri http://localhost:15443/xiaojingling
8 verbose request uri http://localhost:15443/-/package/xiaojingling/dist-tags
9 verbose request always-auth set; sending authorization
10 info attempt registry request try #1 at 3:37:28 PM
11 verbose request id 8e9018f190ad3d49
12 http request GET http://localhost:15443/-/package/xiaojingling/dist-tags
13 http 404 http://localhost:15443/-/package/xiaojingling/dist-tags
14 verbose headers { 'content-type': 'application/json',
14 verbose headers   date: 'Sat, 11 Jul 2015 22:37:28 GMT',
14 verbose headers   connection: 'keep-alive',
14 verbose headers   'transfer-encoding': 'chunked' }
15 error dist-tag ls Couldn't get dist-tag data for xiaojingling
16 verbose stack Error: missing : -/package/xiaojingling/dist-tags
16 verbose stack     at CachingRegistryClient.<anonymous> (/Users/Maggie/npm-global/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:247:14)
16 verbose stack     at Request._callback (/Users/Maggie/npm-global/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:170:14)
16 verbose stack     at Request.self.callback (/Users/Maggie/npm-global/lib/node_modules/npm/node_modules/request/request.js:197:22)
16 verbose stack     at Request.emit (events.js:110:17)
16 verbose stack     at Request.<anonymous> (/Users/Maggie/npm-global/lib/node_modules/npm/node_modules/request/request.js:1050:14)
16 verbose stack     at Request.emit (events.js:129:20)
16 verbose stack     at IncomingMessage.<anonymous> (/Users/Maggie/npm-global/lib/node_modules/npm/node_modules/request/request.js:996:12)
16 verbose stack     at IncomingMessage.emit (events.js:129:20)
16 verbose stack     at _stream_readable.js:908:16
16 verbose stack     at process._tickCallback (node.js:355:11)
17 verbose statusCode 404
18 verbose cwd /Users/Maggie/howtonpm-workshop
19 error Darwin 14.3.0
20 error argv "node" "/Users/Maggie/npm-global/bin/npm" "dist-tag" "ls"
21 error node v0.12.0
22 error npm  v2.13.0
23 error code E404
24 error 404 missing : -/package/xiaojingling/dist-tags
25 verbose exit [ 1, true ]

from how-to-npm.

iuvbio avatar iuvbio commented on May 18, 2024

same problem here. repeated the last two steps, I have three versions (1.0.0, 1.0.1, 1.0.2), all of them are definitely published. I have tried the syntax @mpmckenna8 proposed and the "normal" one without the username, but both didn't work.

404 missing : -/package/@iuvbio%2fhow-to-npm/dist-tags

from how-to-npm.

Silerra avatar Silerra commented on May 18, 2024

I recently had the same problem. I can't understand why the step "Dist Tag" fails when the "npm publish" had previously failed once. Then I have tried different ways to go about this bug out of the way.

Finally helped me only the following steps:

  1. Delete the project folder in which you last used for your workshop.
  2. Empty your trash folder. (Because Ubuntu derivatives possibly the 'HOW-TO-NPM' a dirty link created to the Trash. That already happened to me too.)
  3. Reset the Workshop with: how-to-npm reset
  4. Create again a new folder for your how-to-npm workshop.
  5. Start again your project. However possible tidy.

Good luck!

from how-to-npm.

iuvbio avatar iuvbio commented on May 18, 2024

@Silerra I've done this as well and I'm still getting the same error...

from how-to-npm.

tad avatar tad commented on May 18, 2024

I've run into the same problem as above.

Aborting this chapter due to stuff like this.

from how-to-npm.

aBuzzLife avatar aBuzzLife commented on May 18, 2024

^^ This. After many a fail myself, I finally got this to work for me. Thank you smashzen. Good vibes

from how-to-npm.

claudiopro avatar claudiopro commented on May 18, 2024

@denmch @buck-yeh @mpmckenna8 thanks, using fully qualified module names did the trick!

from how-to-npm.

ZebGirouard avatar ZebGirouard commented on May 18, 2024

@denmch thank you. I really cannot stress enough the importance of this line:

"The solution is to run how-to-npm again and, if necessary, repeat the previous step (or steps)."

This is NOT MENTIONED in the tutorial. In particular, on Step 11 (Dist Tag Removal) it seems to be impossible to run npm publish, without getting errors thrown, yet it is necessary in order to get the tests to pass. It is not just a problem of tests not passing, the command simply WILL NOT RUN in Step 11, so you must go to one of the Publish steps, npm publish tag=something, then return to Step 11, and run how-to-npm verify. This sucked up almost 2 hours of my day. I hope this post helps other people understand the problem quicker.

If you are getting confusing errors, try to return to a step in the tutorial where the command worked, and run the command again.

P.S. @denmch , perhaps you can add a note to this effect in the instructions on the FreeCodeCamp waypoint for this? I appreciate the note about only applying tags to versions that have been published, but this error situation seems way more common and confusing.

from how-to-npm.

ashleygwilliams avatar ashleygwilliams commented on May 18, 2024

closing for #45

from how-to-npm.

msgesq avatar msgesq commented on May 18, 2024

Thanks @RandyDavis . Your solution worked for me and was the easiest to understand of the all the suggested solutions.

from how-to-npm.

 avatar commented on May 18, 2024

Thank you @RandyDavis. I completely agree with mgrezzy. It's the best explanation. Pity that after 2hours strugling i found this explanation. THX

from how-to-npm.

Mikestella avatar Mikestella commented on May 18, 2024

@RandyDavis Thank you so much for explaining that even further. It has helped alot and I really appreciate it dude.

from how-to-npm.

Rhpozzo avatar Rhpozzo commented on May 18, 2024

ronin:/workspace/fcc $ npm dist-tag add @ronin/[email protected] beta
+beta: @ronin/[email protected]
ronin:
/workspace/fcc $ npm ls
@ronin/[email protected] /home/ubuntu/workspace/fcc
└── @linclark/[email protected]

ronin:~/workspace/fcc $ how-to-npm verify

Congratulations!  You've added a dist-tag!

This is a handy way to manage releases.  For example, the npm project
itself publishes each new version as 'next' (instead of 'latest') so
that beta users can test it out before it becomes the default.

from how-to-npm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.