kulshekhar / ts-jest

A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.

Home Page:https://kulshekhar.github.io/ts-jest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: npm install hang

joonseokhu opened this issue · comments

Version

27.1.4

Steps to reproduce

  1. init new project
    cd ~
    mkdir ts-jest-hang-test
    cd ts-jest-hang-test
    npm init -y
    
  2. install ts-jest
    npm i -D ts-jest
    

Expected behavior

install successfully

Actual behavior

socket hangs for maximum npm fetch timeout (default 5mins)

Debug log

0 verbose cli /Users/hujoonseok/.nvm/versions/node/v16.19.0/bin/node /Users/hujoonseok/.nvm/versions/node/v16.19.0/bin/npm
1 info using npm@8.19.3
2 info using node@v16.19.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/hujoonseok/Desktop/foobar/.npmrc Completed in 1ms
10 timing config:load:project Completed in 4ms
11 timing config:load:file:/Users/hujoonseok/.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/Users/hujoonseok/.nvm/versions/node/v16.19.0/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm i ts-jest
23 verbose argv "i" "--save-dev" "ts-jest"
24 timing npm:load:setTitle Completed in 13ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 4ms
27 verbose logfile logs-max:10 dir:/Users/hujoonseok/.npm/_logs
28 verbose logfile /Users/hujoonseok/.npm/_logs/2023-01-17T06_18_08_473Z-debug-0.log
29 timing npm:load:logFile Completed in 4ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 34ms
33 timing arborist:ctor Completed in 0ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 93ms
37 timing idealTree:userRequests Completed in 1ms
38 silly idealTree buildDeps
39 silly fetch manifest ts-jest@*
40 timing arborist:ctor Completed in 0ms
41 silly placeDep ROOT ts-jest@ OK for: foobar@1.0.0 want: *
42 timing idealTree:#root Completed in 300133ms
43 timing idealTree:node_modules/ts-jest Completed in 0ms
44 timing idealTree:buildDeps Completed in 300133ms
45 timing idealTree:fixDepFlags Completed in 1ms
46 timing idealTree Completed in 300229ms
47 timing command:i Completed in 300242ms
48 verbose type invalid-json
49 verbose stack FetchError: invalid json response body at https://registry.npmjs.org/ts-jest reason: Invalid response body while trying to fetch https://registry.npmjs.org/ts-jest: aborted
49 verbose stack     at Response.json (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/minipass-fetch/lib/body.js:79:13)
49 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
49 verbose stack     at async RegistryFetcher.packument (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:99:25)
49 verbose stack     at async RegistryFetcher.manifest (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:124:23)
49 verbose stack     at async Arborist.[nodeFromEdge] (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1061:19)
49 verbose stack     at async Arborist.[buildDepStep] (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:930:11)
49 verbose stack     at async Arborist.buildIdealTree (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:211:7)
49 verbose stack     at async Promise.all (index 1)
49 verbose stack     at async Arborist.reify (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:154:5)
49 verbose stack     at async Install.exec (/Users/hujoonseok/.nvm/versions/node/v16.19.0/lib/node_modules/npm/lib/commands/install.js:145:5)
50 verbose cwd /Users/hujoonseok/Desktop/foobar
51 verbose Darwin 21.6.0
52 verbose node v16.19.0
53 verbose npm  v8.19.3
54 error code FETCH_ERROR
55 error errno FETCH_ERROR
56 error invalid json response body at https://registry.npmjs.org/ts-jest reason: Invalid response body while trying to fetch https://registry.npmjs.org/ts-jest: aborted
57 verbose exit 1
58 timing npm Completed in 300337ms
59 verbose unfinished npm timer reify 1673936288565
60 verbose unfinished npm timer reify:loadTrees 1673936288574
61 verbose code 1
62 error A complete log of this run can be found in:
62 error     /Users/hujoonseok/.npm/_logs/2023-01-17T06_18_08_473Z-debug-0.log

Additional context

No response

Environment

System:
  OS: macOS 12.5.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
  Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
  npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm

I am experiencing the same issue in my local machine(windows 11, node 16.19.0, npm 8.19.3).
But, when npm i was performed with github action(ubuntu 20.04, node 16.x), it was installed normally.

commented

This is package manager server issue, ts-jest cannot do anything in this case.

I'm having same issue now. There are some reports in twitter (link1
link2) that Korean mobile carrier KT might be the culprit, cannot find any reason.

Since my phone's mobile carrier is not kt, I turned on tethering and solved.

I contacted the npm registry and got a response that there will be action.
https://twitter.com/devkcuri/status/1615996076590497793

It is recommended to use an npm mirror that can be replaced until stable.
https://npmjs.cf/