jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.51k stars 21 forks source link

Process often hangs for a long time without finding typedefs #56

Closed Vages closed 4 years ago

Vages commented 4 years ago

Hi!

Thanks for a great package.

npx typesync (v0.7.0 as well as v0.6.1) often hangs indefinitely. I tried letting the process run for one hour before posting this issue. No types are found. Other times everything works out fine – and that takes less than 60 seconds. I have not found any pattern.

I have tried connecting to the Internet through

  1. my home Wifi,
  2. my cell-phone as an access point and
  3. my workplace's VPN.

None of these seem to guarantee either success or failure. (As for success percentage, I've not made any thorough notes.)

My project has the following package.json. Note that @myscope/some-package (a pseudonym for a package that I've had to redact) is configured to be fetched from an alternative registry, as seen here: https://docs.npmjs.com/files/npmrc#comments I have tried deleting @myscope/some-package, to no avail.

{
  "name": <redacted>,
  "productName": <redacted>,
  "version": <redacted>,
  "description": <redacted>,
  "main": "electron_main.js",
  "scripts": {
    "nps": "nps",
    "postinstall": "npx patch-package"
  },
  "repository": {
    "type": "git",
    "url": <redacted>
  },
  "resolutions": {
    "**/cypress": "~4.12.1"
  },
  "author": <redacted>,
  "contributors":<redacted>,
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "~7.11.1",
    "@babel/plugin-proposal-class-properties": "~7.10.4",
    "@babel/plugin-proposal-nullish-coalescing-operator": "~7.10.1",
    "@babel/plugin-proposal-optional-chaining": "~7.11.0",
    "@babel/plugin-transform-react-jsx-source": "~7.10.5",
    "@babel/preset-env": "~7.11.0",
    "@babel/preset-react": "~7.10.4",
    "@babel/preset-typescript": "~7.8.3",
    "@cypress/webpack-preprocessor": "~4.1.2",
    "@emotion/babel-preset-css-prop": "~10.0.27",
    "@hookform/devtools": "~2.0.4",
    "@khanacademy/flow-to-ts": "^0.1.6",
    "@prettier/plugin-xml": "~0.9.0",
    "@sentry/cli": "~1.51.1",
    "@testing-library/cypress": "~6.0.0",
    "@types/jest": "~26.0.10",
    "@typescript-eslint/eslint-plugin": "3.6.0",
    "@typescript-eslint/parser": "3.6.0",
    "audit-ci": "~3.0.0",
    "await-exec": "~0.1.2",
    "axios-mock-adapter": "~1.17.0",
    "babel-eslint": "~10.1.0",
    "babel-jest": "~26.3.0",
    "babel-loader": "~8.1.0",
    "circular-dependency-plugin": "~5.2.0",
    "concurrently": "~5.0.2",
    "cross-env": "~7.0.2",
    "csp-html-webpack-plugin": "~3.0.4",
    "css-loader": "~3.2.0",
    "cypress": "~4.12.1",
    "cypress-plugin-retries": "~1.5.2",
    "cypress-plugin-tab": "~1.0.5",
    "death": "~1.1.0",
    "defaultdict2": "~1.1.1",
    "dyson": "~3.0.3",
    "electron": "~9.2.0",
    "electron-builder": "~22.8.0",
    "electron-download": "~4.1.1",
    "emoji-strip": "~1.0.1",
    "empty": "file:./lib/empty",
    "enzyme": "~3.10.0",
    "enzyme-adapter-react-16": "~1.15.3",
    "eslint": "~7.5.0",
    "eslint-config-airbnb-typescript": "~8.0.2",
    "eslint-config-prettier": "~6.11.0",
    "eslint-plugin-cypress": "~2.11.1",
    "eslint-plugin-emotion": "~10.0.27",
    "eslint-plugin-fp": "~2.3.0",
    "eslint-plugin-functional": "~3.0.1",
    "eslint-plugin-import": "~2.22.0",
    "eslint-plugin-jsx-a11y": "~6.3.1",
    "eslint-plugin-lodash": "~7.1.0",
    "eslint-plugin-lodash-fp": "~2.2.0-a1",
    "eslint-plugin-prettier": "~3.1.4",
    "eslint-plugin-react": "~7.20.6",
    "eslint-plugin-react-hooks": "~4.0.8",
    "eslint-plugin-simple-import-sort": "~5.0.2",
    "eslint-plugin-unicorn": "~21.0.0",
    "eslint-plugin-you-dont-need-lodash-underscore": "~6.10.0",
    "faker": "~4.1.0",
    "fast-glob": "~3.2.2",
    "file-loader": "~5.1.0",
    "full-icu": "~1.3.0",
    "html-loader": "~0.5.5",
    "html-webpack-plugin": "~3.2.0",
    "husky": "~4.2.3",
    "hygen": "~6.0.4",
    "jest": "~26.4.2",
    "jest-canvas-mock": "~2.2.0",
    "jscodeshift": "~0.10.0",
    "json5-loader": "~3.0.0",
    "less": "~3.12.2",
    "less-loader": "~5.0.0",
    "lint-staged": "~10.2.11",
    "markdown-loader": "~5.1.0",
    "markdownlint-cli": "~0.23.2",
    "mini-css-extract-plugin": "~0.9.0",
    "mock-local-storage": "~1.1.15",
    "npm-scripts-info": "~0.3.9",
    "nps": "~5.10.0",
    "nps-utils": "~1.7.0",
    "nyc": "~15.1.0",
    "patch-package": "~6.2.0",
    "postinstall-postinstall": "~2.0.0",
    "prettier": "~2.0.5",
    "prettier-plugin-sh": "~0.5.0",
    "prompt": "~1.0.0",
    "react-json-view": "~1.19.1",
    "react-test-renderer": "~16.10.2",
    "semantic-ui-less": "~2.4.1",
    "sonar-project-properties": "~1.0.2",
    "style-loader": "~1.0.0",
    "stylelint": "~13.2.1",
    "stylelint-config-property-sort-order-smacss": "~6.0.0",
    "stylelint-config-standard": "~20.0.0",
    "stylelint-prettier": "~1.1.2",
    "talkback": "~2.1.1",
    "tempy": "~0.5.0",
    "typesync": "0.7.0",
    "url-loader": "~3.0.0",
    "webpack": "~4.44.1",
    "webpack-cli": "~3.3.11",
    "webpack-dev-middleware": "~3.7.2",
    "webpack-dev-server": "~3.11.0",
    "webpack-hot-middleware": "~2.25.0",
    "webpack-merge": "~4.2.2",
    "yarnhook": "~0.4.3"
  },
  "dependencies": {
    "@emotion/core": "~10.0.34",
    "@entur/a11y": "~0.2.25",
    "@entur/alert": "~0.6.3",
    "@entur/button": "~2.3.2",
    "@entur/chip": "~0.3.23",
    "@entur/datepicker": "~0.3.28",
    "@entur/dropdown": "~1.3.6",
    "@entur/expand": "~3.2.8",
    "@entur/fileupload": "~0.3.4",
    "@entur/form": "~3.3.0",
    "@entur/icons": "~1.10.0",
    "@entur/layout": "~1.7.2",
    "@entur/loader": "~0.3.23",
    "@entur/menu": "~3.0.2",
    "@entur/modal": "~1.1.26",
    "@entur/tab": "~0.4.13",
    "@entur/table": "~3.1.2",
    "@entur/tokens": "~1.4.0",
    "@entur/tooltip": "~2.2.4",
    "@entur/travel": "~4.0.10",
    "@entur/typography": "~1.2.2",
    "@hookform/resolvers": "~0.0.6",
    "@hot-loader/react-dom": "~16.11.0",
    <@myscope/some-package>: "~0.1.7",
    "@sentry/electron": "~1.2.0",
    "@sentry/integrations": "~5.12.4",
    "about-window": "~1.13.1",
    "animate.css": "~3.7.2",
    "apollo-cache-inmemory": "~1.6.3",
    "apollo-client": "~2.6.4",
    "apollo-link": "~1.2.13",
    "apollo-link-context": "~1.0.19",
    "apollo-link-error": "~1.1.12",
    "apollo-link-http": "~1.5.16",
    "axios": "~0.19.0",
    "base64-stream": "~1.0.0",
    "body-parser": "~1.19.0",
    "chalk": "~3.0.0",
    "classnames": "~2.2.6",
    "cleave.js": "~1.5.3",
    "config": "~3.2.5",
    "core-js": "~3.3.2",
    "cors": "~2.8.5",
    "crypto-random-string": "~3.2.0",
    "date-fns": "~2.9.0",
    "decoders": "~1.16.1",
    "electron-better-ipc": "~1.1.1",
    "electron-context-menu": "~2.3.0",
    "electron-log": "~4.2.4",
    "electron-updater": "~4.3.4",
    "electron-util": "~0.14.1",
    "express": "~4.17.1",
    "express-correlation-id": "~1.3.1",
    "express-jwt": "~5.3.1",
    "focus-trap-react": "~6.0.0",
    "formik": "~2.1.5",
    "formik-persist": "file:./lib/formik-persist",
    "graphql": "~14.5.8",
    "graphql-tag": "~2.10.1",
    "helmet": "~3.21.1",
    "http-proxy-middleware": "~1.0.2",
    "http-status-codes": "~1.3.2",
    "immutable": "~4.0.0-rc.12",
    "is-electron": "~2.2.0",
    "is-ip": "~3.1.0",
    "js-deep-equals": "~2.1.1",
    "jsbarcode": "~3.11.0",
    "json5": "~2.1.1",
    "jspdf": "~1.5.3",
    "jwks-rsa": "~1.6.0",
    "jwt-decode": "~2.2.0",
    "lemons": "~1.4.1",
    "lodash": "~4.17.19",
    "memory-cache": "~0.2.0",
    "morgan": "~1.9.1",
    "papaparse": "~5.2.0",
    "pretty-bytes": "~5.3.0",
    "query-string": "~6.10.1",
    "react": "~16.13.1",
    "react-dom": "~16.13.1",
    "react-flatpickr": "~3.9.1",
    "react-hook-form": "~6.0.2",
    "react-hot-loader": "~4.12.15",
    "react-hotkeys-hook": "~2.1.4",
    "react-json-view": "~1.19.1",
    "react-markdown": "~4.3.1",
    "react-onclickoutside": "~6.9.0",
    "react-query": "~2.4.7",
    "react-redux": "~7.2.1",
    "react-redux-typescript-scripts": "~1.6.2",
    "react-router-dom": "~5.1.2",
    "react-select": "~1.3.0",
    "react-toastify": "~5.4.0",
    "redux": "~4.0.4",
    "redux-actions": "~2.6.5",
    "redux-form": "~8.2.6",
    "redux-logger": "~3.0.6",
    "redux-saga": "~1.1.1",
    "redux-sentry-middleware": "~0.1.2",
    "remark": "~12.0.1",
    "semantic-ui-react": "~0.88.1",
    "shortid": "~2.2.15",
    "strip-markdown": "~3.1.2",
    "typesafe-actions": "~5.1.0",
    "typescript": "~3.9.6",
    "utility-types": "~3.10.0",
    "wait-on": "~4.0.1",
    "webstomp-client": "~1.2.6",
    "whatwg-fetch": "~3.0.0",
    "wkhtmltopdf": "~0.3.4",
    "yup": "~0.28.3"
  },
  "jestSonar": {
    "reportPath": "reports/",
    "reportFile": "jest-sonar-report.xml",
    "indent": 4
  }
}
jeffijoe commented 4 years ago

Sounds like a network issue. Axios (the HTTP lib) does not have a timeout set so it would hang indefinitely.

Vages commented 4 years ago

My suspicion too. Is there any hidden debug flag for the CLI, @jeffijoe? (I'm downloading the repo in order to debug more, but simpler debugging would be great.)

jeffijoe commented 4 years ago

I suppose you can use DEBUG=* typesync, any libs that use debug would start logging. :)

Vages commented 4 years ago

Turns out I can guarantee success by deleting (only) the line in devDependencies for webpack. That's strange.

I'll try checking with some of my team mates to see if they can reproduce this.

Vages commented 4 years ago

I got 5 teammates to try and reproduce the bug, all using the same node version. One of my teammates uses Linux, while the rest uses MacOS. Only one was able to reproduce the bug, he was on Mac OS.

I was able to solve the issue for me by upgrading to the latest version of node 12. I'm therefore closing the issue, although this didn't help my team mate. We've not found any consistency regarding MacOS versions (10.15 vs. 10.14).

jeffijoe commented 4 years ago

That's odd, I am on macOS as well, and I also use Webpack.

Vages commented 4 years ago

Yeah. Feel free to comment more if you're interested in drilling down into this, but until more users report similar problems, I don't think it's a good use of time.