nats-io / nats.node

Node.js client for NATS, the cloud native messaging system.
https://nats.io
Apache License 2.0
1.55k stars 163 forks source link

Namespace '"tls"' has no exported member 'TlsOptions'. #211

Closed devpro9219 closed 6 years ago

devpro9219 commented 6 years ago

Hi. I am using

"nats": "^0.7.26",
   "nats-hemera": "^3.1.7","

And When I run this app I got the error message"

./node_modules/nats/index.d.ts:64:22 TS2694: Namespace '"tls"' has no exported member 'TlsOptions'.

When I change tls?: boolean | tls.TlsOptions to tls?: boolean | tls.TlsServerOptions, Then It's working.. Please explain how to solve this problem in the default way.

aricart commented 6 years ago

I am guessing that you are running into a transient issue. At some point in February, the typescript folks renamed tls.Options to tls.ServerOptions. That was quickly reverted. See https://github.com/nats-io/node-nats/pull/187. Please update to node-nats v0.8.2, and to the latest typescript.

devpro9219 commented 6 years ago

I updated nats v0.8.2 and typescript to 2.7.1. But still not working.

> `{
>     "private": true,
>     "version": "0.2.0",
>     "scripts": {
>         "jest": "./node_modules/.bin/jest",
>         "compile": "lerna exec -- npm run compile",
>         "lint": "tslint ./packages/**/src/**/*.ts --exclude \"./packages/**/node_modules/**/*.ts\"",
>         "publish": "lerna publish",
>         "publish:force": "npm run publish -- --force-publish=*",
>         "lerna": "lerna bootstrap --hoist",
>         "install": "npm run lerna",
>         "clean": "lerna clean",
>         "start": "npm run spin:watch",
>         "spin:build": "cross-env NODE_ENV=production spin build",
>         "spin:watch": "cross-env ENV_FILE=config/development/dev.env spin watch",
>         "spin:watch:debug": "npm run spin:watch -- -v",
>         "spin:exp": "spin exp",
>         "watch": "lerna exec --no-sort --ignore *server --stream --parallel -- webpack --watch",
>         "prodBuild": "cross-env NODE_ENV=production babel-node --presets es2015 tools/webpack.run",
>         "build": "npm run build:packages",
>         "build:packages": "lerna run build --ignore *server",
>         "build:packages:watch": "lerna run build:lib:watch --ignore *server --stream",
>         "prebootstrap": "npm install",
>         "db:migrate": "knex migrate:latest --cwd . --knexfile ./servers/backend-server/knexfile.js",
>         "db:migrate:rollback": "knex migrate:rollback  --cwd . --knexfile ./servers/backend-server/knexfile.js",
>         "db:seed": "npm run db:migrate && knex seed:run  --cwd . --knexfile ./servers/backend-server/knexfile.js",
>         "test": "jest",
>         "posttest": "npm run lint",
>         "coverage": "jest --coverage",
>         "pretravis": "npm run compile",
>         "travis": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --full-trace ./test/tests.js",
>         "posttravis": "npm run lint",
>         "postcoverage": "remap-istanbul --input coverage/coverage.raw.json --type lcovonly --output coverage/lcov.info",
>         "check-updates": "lerna exec ./node_modules/.bin/npm-check-updates -- -u"
>     },
>     "jest": {
>         "testEnvironment": "node",
>         "roots": [
>             "packages"
>         ],
>         "moduleFileExtensions": [
>             "ts",
>             "tsx",
>             "js"
>         ],
>         "transform": {
>             "\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
>         },
>         "testRegex": "/__tests__/.*test*\\.(ts|tsx|js)$"
>     },
>     "repository": {
>         "type": "git",
>         "url": "git+https://github.com/cdmbase/fullstack-pro.git"
>     },
>     "author": "CDMBase LLC",
>     "license": "MIT",
>     "bugs": {
>         "url": "https://github.com/cdmbase/fullstack-pro/issues"
>     },
>     "homepage": "https://github.com/cdmbase/fullstack-pro#readme",
>     "engines": {
>         "node": ">=8.0.0",
>         "npm": ">=5.0.0"
>     },
>     "devDependencies": {
>         "@types/async": "^2.0.40",
>         "@types/body-parser": "1.16.5",
>         "@types/bunyan": "^1.8.0",
>         "@types/cors": "2.8.1",
>         "@types/enzyme": "^2.8.0",
>         "@types/express": "^4.0.35",
>         "@types/graphql": "^0.11.8",
>         "@types/isomorphic-fetch": "0.0.34",
>         "@types/jest": "^22.1.1",
>         "@types/knex": "^0.14.5",
>         "@types/mongodb": "^2.2.9",
>         "@types/minimist": "^1.2.0",
>         "@types/nats-hemera": "^2.0.0",
>         "@types/node": "^8.9.0",
>         "@types/prop-types": "^15.5.1",
>         "@types/react": "^16.0.36",
>         "@types/react-addons-test-utils": "^0.14.18",
>         "@types/react-dom": "^16.0.3",
>         "@types/react-helmet": "^5.0.3",
>         "@types/react-redux": "^5.0.8",
>         "@types/recompose": "^0.24.1",
>         "@types/semver": "^5.5.0",
>         "@types/sinon": "^4.1.0",
>         "@types/webpack": "^3.8.4",
>         "@types/webpack-env": "^1.13.5",
>         "@types/zen-observable": "^0.5.3",
>         "apollo-codegen": "^0.18.3",
>         "apollo-test-utils": "^0.3.2",
>         "autoprefixer": "^7.2.5",
>         "awesome-typescript-loader": "^3.4.1",
>         "babel-cli": "^6.26.0",
>         "babel-core": "^6.26.0",
>         "babel-eslint": "^8.2.1",
>         "babel-loader": "^7.1.2",
>         "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
>         "babel-plugin-transform-object-rest-spread": "^6.26.0",
>         "babel-polyfill": "^6.26.0",
>         "babel-preset-es2015": "^6.24.0",
>         "caporal": "^0.9.0",
>         "concurrently": "^3.5.0",
>         "connect": "^3.6.5",
>         "copy-webpack-plugin": "^4.3.1",
>         "cross-env": "^5.1.3",
>         "css-loader": "^0.28.0",
>         "enzyme": "^3.3.0",
>         "enzyme-adapter-react-16": "^1.1.1",
>         "express": "^4.16.2",
>         "eslint": "^4.17.0",
>         "eslint-plugin-graphql": "^1.5.0",
>         "extract-text-webpack-plugin": "^3.0.0",
>         "file-loader": "^1.1.6",
>         "freeport-async": "^1.1.1",
>         "fs-extra": "^4.0.2",
>         "graphql-code-generator": "^0.8.14",
>         "haul": "1.0.0-beta.6",
>         "hemera-testsuite": "^2.0.5",
>         "html-loader": "^0.5.1",
>         "html-webpack-plugin": "^2.30.1",
>         "http-proxy-middleware": "^0.17.4",
>         "husky": "^0.14.3",
>         "ignore-loader": "^0.1.2",
>         "image-size": "^0.6.1",
>         "ip": "^1.1.5",
>         "isomorphic-style-loader": "^4.0.0",
>         "istanbul": "1.0.0-alpha.2",
>         "jest": "^22.1.0",
>         "jest-cli": "^22.1.0",
>         "jsdom": "^11.6.0",
>         "json-loader": "^0.5.7",
>         "lerna": "2.8.0",
>         "lint-staged": "^6.1.0",
>         "lodash": "^4.17.4",
>         "mime": "^2.2.0",
>         "minilog": "^3.1.0",
>         "mkdirp": "^0.5.1",
>         "mocha": "^4.0.1",
>         "mocha-steps": "^1.1.0",
>         "mocha-webpack": "^0.7.0",
>         "module": "^1.2.5",
>         "morgan": "^1.8.1",
>         "nock": "^9.1.6",
>         "node-dev": "^3.1.3",
>         "node-sass": "^4.7.2",
>         "nodemon": "^1.14.12",
>         "npm-check-updates": "^2.14.0",
>         "openurl": "^1.1.1",
>         "persistgraphql-webpack-plugin": "^0.4.4",
>         "postcss-loader": "^2.1.0",
>         "prettier": "^1.10.2",
>         "qrcode-terminal": "^0.11.0",
>         "raw-loader": "^0.5.1",
>         "react-addons-test-utils": "^15.6.2",
>         "react-test-renderer": "^16.2.0",
>         "redux-devtools": "^3.4.0",
>         "redux-devtools-dock-monitor": "^1.1.2",
>         "redux-devtools-log-monitor": "^1.4.0",
>         "redux-mock-store": "^1.2.3",
>         "remap-istanbul": "^0.9.5",
>         "resolve-url-loader": "^2.2.1",
>         "rimraf": "^2.6.1",
>         "sass-loader": "^6.0.6",
>         "shelljs": "^0.7.8",
>         "sinon": "^4.2.2",
>         "sinon-as-promised": "^4.0.3",
>         "source-list-map": "^2.0.0",
>         "source-map-loader": "^0.2.1",
>         "source-map-support": "^0.5.0",
>         "spinjs": "0.4.18",
>         "standard-version": "^4.0.0",
>         "style-loader": "^0.20.1",
>         "tcomb": "^3.2.24",
>         "ts-jest": "^22.0.3",
>         "ts-loader": "^3.5.0",
>         "ts-node": "^4.1.0",
>         "tslint": "^5.0.0",
>         "tslint-loader": "^3.5.3",
>         "tslint-react": "^3.0.0",
>         "typescript": "2.7.1",
>         "typescript-require": "^0.2.9-1",
>         "uglifyjs-webpack-plugin": "^1.0.0-beta.3",
>         "url-loader": "^0.6.2",
>         "wait-on": "^2.0.2",
>         "webpack": "^3.10.0",
>         "webpack-dev-middleware": "^2.0.4",
>         "webpack-dev-server": "^2.9.7",
>         "webpack-fail-plugin": "^2.0.0",
>         "webpack-hot-middleware": "^2.21.0",
>         "webpack-manifest-plugin": "^1.3.2",
>         "webpack-merge": "^4.1.1",
>         "webpack-node-externals": "^1.6.0",
>         "webpack-sources": "^1.1.0",
>         "webpack-virtual-modules": "^0.1.8",
>         "webpack-visualizer-plugin": "^0.1.11",
>         "ws": "^3.3.3"
>     },
>     "dependencies": {
>         "@cdm-logger/client": "^3.1.1",
>         "@cdm-logger/server": "^3.0.2",
>         "apollo-cache-inmemory": "^1.1.7",
>         "apollo-client": "^2.2.2",
>         "apollo-fetch": "^0.7.0",
>         "apollo-fetch-upload": "^1.2.0",
>         "apollo-engine": "^0.8.8",
>         "apollo-link": "^1.0.7",
>         "apollo-link-batch-http": "^1.0.4",
>         "apollo-link-ws": "^1.0.4",
>         "apollo-logger": "^0.1.0",
>         "apollo-upload-server": "^4.0.2",
>         "app-root-path": "^2.0.1",
>         "body-parser": "^1.18.2",
>         "browser-bunyan": "^1.2.2",
>         "bunyan": "^1.8.10",
>         "base-64": "^0.1.0",
>         "classnames": "^2.2.5",
>         "cors": "^2.8.3",
>         "dotenv": "^5.0.0",
>         "export-dir": "^0.1.2",
>         "fela": "6.1.3",
>         "fela-beautifier": "^5.0.15",
>         "fela-dom": "7.0.4",
>         "fela-font-renderer": "^5.0.10",
>         "fela-perf": "^5.0.3",
>         "fela-plugin-fallback-value": "^5.0.16",
>         "fela-plugin-logger": "^5.0.4",
>         "fela-plugin-lvha": "^5.0.15",
>         "fela-plugin-prefixer": "^5.0.16",
>         "fela-plugin-unit": "^5.0.15",
>         "fela-plugin-validator": "^5.0.17",
>         "graphql": "^0.11.7",
>         "graphql-auth": "^0.2.0",
>         "graphql-resolve-batch": "^1.0.2",
>         "graphql-nats-subscriptions": "^1.1.0",
>         "graphql-server-core": "^1.3.2",
>         "graphql-server-express": "^1.3.2",
>         "graphql-subscriptions": "^0.5.6",
>         "graphql-tag": "^2.6.1",
>         "graphql-tools": "2.19.0",
>         "helmet": "^3.10.0",
>         "hemera-joi": "^3.0.1",
>         "hemera-plugin": "0.1.1",
>         "hemera-safe-promises": "0.0.2",
>         "hemera-sql-store": "^4.0.0",
>         "hemera-zipkin": "^3.0.1",
>         "hemera-mongo-store": "^1.1.2",
>         "identicon.js": "^2.3.1",
>         "immutability-helper": "^2.2.2",
>         "inversify": "^4.10.0",
>         "isomorphic-fetch": "^2.2.1",
>         "knex": "^0.13.0",
>         "material-ui": "^1.0.0-beta.31",
>         "material-ui-icons": "^1.0.0-beta.17",
>         "mongoose": "^4.9.8",
>         "nats": "^0.8.2",
>         "nats-hemera": "^3.1.7",
>         "nconf": "^0.10.0",
>         "node-pre-gyp": "~0.6.31",
>         "prettysize": "^0.1.0",
>         "persistgraphql": "^0.3.11",
>         "prop-types": "^15.6.0",
>         "react": "^16.2.0",
>         "react-apollo": "^2.0.4",
>         "react-dom": "^16.2.0",
>         "react-fela": "6.2.4",
>         "react-helmet": "^5.2.0",
>         "react-redux": "^5.0.6",
>         "react-redux-typescript": "^2.3.0",
>         "react-router-dom": "^4.2.2",
>         "react-router-redux": "^4.0.8",
>         "react-transition-group": "^2.2.1",
>         "reactstrap": "^4.6.2",
>         "recompose": "^0.26.0",
>         "rc-steps": "^3.1.0",
>         "react-bootstrap": "^0.32.1",
>         "react-router-bootstrap": "^0.24.4",
>         "react-step-wizard": "^1.2.1",
>         "react-stepzilla": "^4.7.0",
>         "redux": "^3.7.2",
>         "redux-devtools-extension": "^2.13.2",
>         "redux-injectable-reducer": "^1.0.3",
>         "redux-injectable-store": "^1.0.0",
>         "redux-thunk": "^2.2.0",
>         "reflect-metadata": "^0.1.12",
>         "reselect": "^3.0.1",
>         "rxjs": "^5.5.6",
>         "sequelize": "^4.32.6",
>         "serialize-javascript": "^1.4.0",
>         "sqlite3": "^3.1.8",
>         "styled-components": "^2.0.0",
>         "subscriptions-transport-ws": "^0.9.5"
>     }
> }
> `

This is my package.json file.

aricart commented 6 years ago

@GoekhanPolat If you check
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/index.d.ts#L1749

the @types/node has the correct type. Likely your clamping for @types/node is getting you a bad dependency. Try to clamp types/node to 9.4.7.

aricart commented 6 years ago

@GoekhanPolat also you can take a look at the dependency you resolved by looking at your node_modules/@types/node/package.json