workshopper / how-to-npm

A module to teach you how to module.
https://www.npmjs.com/package/how-to-npm
ISC License
1.12k stars 220 forks source link

npm view in stubbed-out npm-world hangs #8

Closed Trott closed 6 years ago

Trott commented 9 years ago

Not sure if this is a problem with my setup or if it's a problem with how-to-npm, but when I do npm view my-package-name as instructed by the verification message in challenge 07 (Publish), it just hangs. Outside the directory I created for the how-to-npm workshopper, npm view whatever works just fine, returning data about packages that exist or an 404 error for packages that don't exist.

linclark commented 9 years ago

Thanks for the report, a few other folks saw this yesterday at the NodeSummit workshop, so it isn't a problem with your setup. We'll have to look into it.

travishorn commented 9 years ago

After it hangs for a minute, I get an error. Here is the npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\nodist\\bin\\\\node.exe',
1 verbose cli   'C:\\nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'view',
1 verbose cli   'howtonpm' ]
2 info using npm@2.6.0
3 info using node@v0.11.14
4 verbose node symlink C:\nodist\bin\\node.exe
5 silly mapToRegistry name howtonpm
6 silly mapToRegistry using default registry
7 silly mapToRegistry registry http://localhost:15443/
8 silly mapToRegistry uri http://localhost:15443/howtonpm
9 verbose request uri http://localhost:15443/howtonpm
10 verbose request no auth needed
11 info attempt registry request try #1 at 11:40:06
12 verbose request id 650a5a74dab801d2
13 http request GET http://localhost:15443/howtonpm
14 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
15 info attempt registry request try #2 at 11:40:17
16 http request GET http://localhost:15443/howtonpm
17 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
18 info attempt registry request try #3 at 11:41:18
19 http request GET http://localhost:15443/howtonpm
20 silly get cb [ 304, undefined ]
21 verbose stack Error: failed to fetch from registry: http://localhost:15443/howtonpm
21 verbose stack     at C:\nodist\bin\node_modules\npm\lib\cache\caching-client.js:163:27
21 verbose stack     at C:\nodist\bin\node_modules\npm\lib\cache\caching-client.js:52:8
21 verbose stack     at f (c:\nodist\bin\node_modules\npm\node_modules\once\once.js:17:25)
21 verbose stack     at c:\nodist\bin\node_modules\npm\node_modules\npm-registry-client\lib\request.js:92:10
21 verbose stack     at f (c:\nodist\bin\node_modules\npm\node_modules\once\once.js:17:25)
21 verbose stack     at CachingRegistryClient.<anonymous> (c:\nodist\bin\node_modules\npm\node_modules\npm-registry-client\lib\request.js:192:20)
21 verbose stack     at Request._callback (c:\nodist\bin\node_modules\npm\node_modules\npm-registry-client\lib\request.js:169:20)
21 verbose stack     at self.callback (c:\nodist\bin\node_modules\npm\node_modules\request\request.js:344:22)
21 verbose stack     at Request.emit (events.js:129:20)
21 verbose stack     at Request.onRequestError (c:\nodist\bin\node_modules\npm\node_modules\request\request.js:961:8)
22 verbose cwd C:\Users\Travis\Temporary\howtonpm
23 error Windows_NT 6.1.7601
24 error argv "C:\\nodist\\bin\\\\node.exe" "C:\\nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js" "view" "howtonpm"
25 error node v0.11.14
26 error npm  v2.6.0
27 error failed to fetch from registry: http://localhost:15443/howtonpm
28 error If you need help, you may report this error at:
28 error     <http://github.com/npm/npm/issues>
29 verbose exit [ 1, true ]
tgfjt commented 9 years ago

Probably same or neary problem.

$ npm view howtonpm

Error Message below:

npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/Users/tgfjt/.nodebrew/current/bin/npm" "view" "howtonpm"
npm ERR! node v0.10.36
npm ERR! npm  v2.7.3
npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=connect ECONNREFUSED
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/tgfjt/workspace/howtonpm/solutions/npm-debug.log

Here npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli   '/Users/tgfjt/.nodebrew/current/bin/npm',
1 verbose cli   'view',
1 verbose cli   'howtonpm' ]
2 info using npm@2.7.3
3 info using node@v0.10.36
4 verbose node symlink /Users/tgfjt/.nodebrew/current/bin/node
5 silly mapToRegistry name howtonpm
6 silly mapToRegistry using default registry
7 silly mapToRegistry registry https://localhost:15443/
8 silly mapToRegistry uri https://localhost:15443/howtonpm
9 verbose request uri https://localhost:15443/howtonpm
10 verbose request no auth needed
11 info attempt registry request try #1 at 14:49:01
12 verbose request id 8d16448aea96cae9
13 http request GET https://localhost:15443/howtonpm
14 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect ECONNREFUSED
15 info attempt registry request try #2 at 14:49:11
16 http request GET https://localhost:15443/howtonpm
17 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect ECONNREFUSED
18 info attempt registry request try #3 at 14:50:11
19 http request GET https://localhost:15443/howtonpm
20 verbose stack Error: tunneling socket could not be established, cause=connect ECONNREFUSED
20 verbose stack     at ClientRequest.onError (/Users/tgfjt/.nodebrew/node/v0.10.36/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
20 verbose stack     at ClientRequest.g (events.js:180:16)
20 verbose stack     at ClientRequest.emit (events.js:95:17)
20 verbose stack     at Socket.socketErrorListener (http.js:1552:9)
20 verbose stack     at Socket.emit (events.js:95:17)
20 verbose stack     at net.js:441:14
20 verbose stack     at process._tickCallback (node.js:442:13)
21 verbose cwd /Users/tgfjt/workspace/howtonpm/solutions
22 error Darwin 14.1.0
23 error argv "node" "/Users/tgfjt/.nodebrew/current/bin/npm" "view" "howtonpm"
24 error node v0.10.36
25 error npm  v2.7.3
26 error code ECONNRESET
27 error network tunneling socket could not be established, cause=connect ECONNREFUSED
27 error network This is most likely not a problem with npm itself
27 error network and is related to network connectivity.
27 error network In most cases you are behind a proxy or have bad network settings.
27 error network
27 error network If you are behind a proxy, please make sure that the
27 error network 'proxy' config is set properly.  See: 'npm help config'
28 verbose exit [ 1, true ]

My Env is:

iojs@v1.6.2

0 info it worked if it ends with ok
1 verbose cli [ '/Users/tgfjt/.nodebrew/iojs/v1.6.2/bin/iojs',
1 verbose cli   '/Users/tgfjt/.nodebrew/current/bin/npm',
1 verbose cli   'view',
1 verbose cli   'howtonpm' ]
2 info using npm@2.7.1
3 info using node@v1.6.2
4 silly mapToRegistry name howtonpm
5 silly mapToRegistry using default registry
6 silly mapToRegistry registry https://localhost:15443/
7 silly mapToRegistry uri https://localhost:15443/howtonpm
8 verbose request uri https://localhost:15443/howtonpm
9 verbose request no auth needed
10 info attempt registry request try #1 at 14:58:46
11 verbose request id a9b3b80ce4c4590a
12 http request GET https://localhost:15443/howtonpm
13 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:15443
14 info attempt registry request try #2 at 14:58:56
15 http request GET https://localhost:15443/howtonpm
16 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:15443
17 info attempt registry request try #3 at 14:59:56
18 http request GET https://localhost:15443/howtonpm
19 verbose stack Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:15443
19 verbose stack     at ClientRequest.onError (/Users/tgfjt/.nodebrew/iojs/v1.6.2/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
19 verbose stack     at ClientRequest.g (events.js:257:16)
19 verbose stack     at emitOne (events.js:77:13)
19 verbose stack     at ClientRequest.emit (events.js:166:7)
19 verbose stack     at Socket.socketErrorListener (_http_client.js:254:9)
19 verbose stack     at emitOne (events.js:77:13)
19 verbose stack     at Socket.emit (events.js:166:7)
19 verbose stack     at net.js:438:14
19 verbose stack     at process._tickCallback (node.js:361:13)
20 verbose cwd /Users/tgfjt/workspace/howtonpm/solutions
21 error Darwin 14.1.0
22 error argv "/Users/tgfjt/.nodebrew/iojs/v1.6.2/bin/iojs" "/Users/tgfjt/.nodebrew/current/bin/npm" "view" "howtonpm"
23 error node v1.6.2
24 error npm  v2.7.1
25 error code ECONNRESET
26 error network tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:15443
26 error network This is most likely not a problem with npm itself
26 error network and is related to network connectivity.
26 error network In most cases you are behind a proxy or have bad network settings.
26 error network
26 error network If you are behind a proxy, please make sure that the
26 error network 'proxy' config is set properly.  See: 'npm help config'
27 verbose exit [ 1, true ]
tdd commented 9 years ago

The way I see it, the workshopper sort of maintains state (as in, a running pseudo-registry) across various steps for a given challenge, and expects them in the exact order, then drops the registry process. This is very brittle, as so many of our NodeSchool Paris attendees, and the people in this thread, can attest.

I would suggest maintaining that kind of state until either the next exercise selection (not just launching the menu: actually selecting an exercise), or a loooong timeout (say, an hour). Any exercise start procedure would drop the existing mock if need be, and start their own.

This is especially important as currently, many steps implicitly require exercises are done in full sequential order, with no holes or anything, for suggested commands to work.

The best way, from a user perspective (not quite from a workshopper author / maintenance / coupling perspective, though), would be a single registry mock that can handle all the challenges, so users don't have to worry about a suggested CLI usage becoming a hang-threat a couple steps down the line, and also for non-linear challenge usage.

brianjsullivan commented 9 years ago

I've also run into this problem. It hangs, but within a few minutes returns an error:

npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "view" "howtonpm"
npm ERR! node v0.10.32
npm ERR! npm  v2.9.1

npm ERR! failed to fetch from registry: http://localhost:15443/howtonpm

The pertinent npm-debug.log content follows:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'view', 'howtonpm' ]
2 info using npm@2.9.1
3 info using node@v0.10.32
4 silly mapToRegistry name howtonpm
5 silly mapToRegistry using default registry
6 silly mapToRegistry registry http://localhost:15443/
7 silly mapToRegistry uri http://localhost:15443/howtonpm
8 verbose request uri http://localhost:15443/howtonpm
9 verbose request no auth needed
10 info attempt registry request try #1 at 11:40:42
11 verbose request id 9f074f936d21cc4b
12 http request GET http://localhost:15443/howtonpm
13 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
14 info attempt registry request try #2 at 11:40:52
15 http request GET http://localhost:15443/howtonpm
16 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
17 info attempt registry request try #3 at 11:41:52
18 http request GET http://localhost:15443/howtonpm
19 silly get cb [ 304, undefined ]
20 verbose stack Error: failed to fetch from registry: http://localhost:15443/howtonpm
20 verbose stack     at /usr/local/lib/node_modules/npm/lib/cache/caching-client.js:163:27
20 verbose stack     at /usr/local/lib/node_modules/npm/lib/cache/caching-client.js:52:8
20 verbose stack     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
20 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:87:10
20 verbose stack     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:17:25)
20 verbose stack     at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:184:20)
20 verbose stack     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:161:20)
20 verbose stack     at self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:368:22)
20 verbose stack     at Request.emit (events.js:117:20)
20 verbose stack     at Request.onRequestError (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1025:8)
21 verbose cwd /Users/user.name.redacted/Documents/nodeschool/howtonpm
22 error Darwin 13.4.0
23 error argv "node" "/usr/local/bin/npm" "view" "howtonpm"
24 error node v0.10.32
25 error npm  v2.9.1
26 error failed to fetch from registry: http://localhost:15443/howtonpm
27 error If you need help, you may report this error at:
27 error     <https://github.com/npm/npm/issues>
28 verbose exit [ 1, true ]

A very similar series of error messages is returned when using npm view without specifying the package to view

jepz commented 9 years ago

I think I'm in the same boat as many others here. Getting errors when trying to publish as an example.

Is there any workarounds suggested? Should i start from scratch again? I'm using Cloud 9 IDE, perhaps i shouldn't?

maddymaster commented 8 years ago

same problem, I am using Cloud 9 IDE. Please help

sawant commented 8 years ago

Here's a solution that worked for me:

  1. Run how-to-npm, and go back to the Login task (even if it's completed)
  2. Do the login task again
  3. Once done, verify
  4. Run how-to-npm, and go to the Publish task
  5. Carry it out and verify

That worked for me.

sawant commented 8 years ago

The problem is that for some reason, the local registry stops working, so to trigger it to start working again, one has to go back to the Login step.