Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how-to-npm chapter 08 publish - Cannot get publish to run #1561

Closed
hferguson opened this issue Nov 29, 2015 · 5 comments · Fixed by workshopper/how-to-npm#127
Closed

how-to-npm chapter 08 publish - Cannot get publish to run #1561

hferguson opened this issue Nov 29, 2015 · 5 comments · Fixed by workshopper/how-to-npm#127

Comments

@hferguson
Copy link

Hello,
I've seen this documented but none of the solutions work. When I run npm publish, I get the following:
E:\development\nodejs\how-to-npm>npm publish
npm ERR! publish Failed PUT 404
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "E:\development\nodejs\node.exe" "C:\Users\Hugh\AppData\Roa
ming\npm\node_modules\npm\bin\npm-cli.js" "publish"
npm ERR! node v4.2.2
npm ERR! npm v3.5.0
npm ERR! code E404

npm ERR! 404 missing : @hferguson/how-to-npm
npm ERR! 404
npm ERR! 404 '@hferguson/how-to-npm' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR! E:\development\nodejs\how-to-npm\npm-debug.log

Oddly though if I run how-to-npm right after, it tells me that my solution is correct. However, eventually I get an unhandled exception by chapter 10 if I leave chapter 08 in this state.
Here is the log file.

npm-debug.txt

Any suggestions?
-Hugh Ferguson
PS I also tried uninstalling and reinstalling the how-to-npm package, which only succeeded after a reboot.
PPS This is Windows 7 environment.

@aliivibrio
Copy link

Hugh,

I encountered the same thing. After a bit of digging, I found that the mock registry was failing to write the .tgz file, due (I think) to writeFileSync on Windows not being able to create a file if the directory you're creating it in doesn't yet exist. I hope to throw a fix together, but you should be able to work around it by:

  1. Going to
    C:\Users\Hugh\.config\how-to-npm\registry\@hferguson\how-to-npm\-
  2. Creating an empty @hferguson folder.

Thanks for posting this, it made me aware that I hadn't messed something up big time!

@betaalpha987
Copy link

Well done benetd, that fixed my identical issue too! It still occurs over a year later. I confess, I wasn't following the instructions in Free Code Camp about using cloud9, I was using my local PC instead (which runs Win 10, hence the problem occurring in Windows). Due to having bad experiences with Cloud9 when trying the FCC MongoDB challenge, and had to give up on it.

@nl-x
Copy link

nl-x commented Mar 11, 2017

@Benetd Thank! This solved my issue as well. The only slightly interesting thing in my case is that my name contains a '-' (dash). Maybe it is related.

And the really frustrating part is, in my case, this would crash the local webserver running the mock npmjs service. It turns out you can restart the service though by running exercise 2 again...

@erichartline
Copy link

Yes, thank you @Benetd! Just ran into the same issue using Windows 10, but that fixed it immediately. Much appreciated.

@shokry-suleiman
Copy link

@Benetd
thanks

vobarian added a commit to vobarian/how-to-npm that referenced this issue Jun 18, 2017
…ctory under dash directory

The JSON sent by `npm publish` contains the property `versions.XXX.dist.tarball` which contains the scope name twice for a scoped package; for example: "http://localhost:15443/@chad/myhowtonpm/-/@chad/myhowtonpm-1.0.0.tgz". The mock registry server attempts to remove the second occurrence of `@scope` from the file path, which causes an error if users try to create another package into which they install the package created in the workshopper using the mock server. The path should be left as-is to match the tarball property in `body.json` so npm can GET it. Removing this code has the additional benefit of fixing a bug on Windows because the regex does not consider backslashes in the path.

See: workshopper#68
Fixes: workshopper#122
Fixes: nodeschool/discussions#1561
Fixes: nodeschool/discussions#2049
vobarian added a commit to vobarian/how-to-npm that referenced this issue Jun 18, 2017
…ctory under dash directory

The JSON sent by `npm publish` contains the property `versions.XXX.dist.tarball` which contains the scope name twice for a scoped package; for example: "http://localhost:15443/@chad/myhowtonpm/-/@chad/myhowtonpm-1.0.0.tgz". The mock registry server attempts to remove the second occurrence of `@scope` from the file path, which causes an error if users try to create another package into which they install the package created in the workshopper using the mock server. The path should be left as-is to match the tarball property in `body.json` so npm can GET it. Removing this code has the additional benefit of fixing a bug on Windows because the regex does not consider backslashes in the path.

See: workshopper#68
Fixes: workshopper#122
Fixes: nodeschool/discussions#1561
Fixes: nodeschool/discussions#2049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants