moleculer-template-project-typescript icon indicating copy to clipboard operation
moleculer-template-project-typescript copied to clipboard

Unable to compile TypeScript

Open nguyenvietanh opened this issue 3 years ago • 6 comments
trafficstars

Dear, Could you please help me in advance, I am facing with error unable to compile TS. image

nguyenvietanh avatar Jun 06 '22 02:06 nguyenvietanh

Hi, i have the same issue. Any solutions?

cyc1e avatar Jun 06 '22 11:06 cyc1e

Hi. You're using REPL v0.7.1, right? Can you set replCommands: [] instead of null?

AndreMaz avatar Jun 06 '22 11:06 AndreMaz

I also set replCommands: [ ], but it's still an error. Seem the file molecluer.config.ts is missing something...

nguyenvietanh avatar Jun 07 '22 01:06 nguyenvietanh

I have moleculer-repl v0.6.6. I did npm outdate and moleculer-repl wasn't on the list of candidates for update. But the docs said that the current version is v0.7.1.. I also tried to instal specific version v0.7.1., but failed. My current

cyc1e avatar Jun 07 '22 12:06 cyc1e

I have moleculer-repl v0.6.6. I did npm outdate and moleculer-repl wasn't on the list of candidates for update. But the docs said that the current version is v0.7.1.. I also tried to instal specific version v0.7.1., but failed. My current config: nodejs 14.15.4 package.json

`{ "name": "geo_service", "version": "1.0.0", "description": "My Moleculer-based microservices project", "scripts": { "build": "tsc --build tsconfig.json", "dev": "ts-node ./node_modules/moleculer/bin/moleculer-runner.js --hot --repl --config moleculer.config.ts services//*.service.ts", "start": "moleculer-runner --config dist/moleculer.config.js", "cli": "moleculer connect NATS", "ci": "jest --watch", "test": "jest --coverage", "lint": "eslint --ext .js,.ts .", "dc:up": "docker-compose up --build -d", "dc:logs": "docker-compose logs -f", "dc:down": "docker-compose down" }, "keywords": [ "microservices", "moleculer" ], "author": "", "devDependencies": { "@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/parser": "^2.26.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.20.2", "eslint-plugin-prefer-arrow": "^1.2.2", "jest": "^25.1.0", "jest-cli": "^25.1.0", "moleculer-repl": "^0.6.6", "ts-jest": "^25.3.0", "ts-node": "^8.8.1" }, "dependencies": { "moleculer-web": "^0.9.0", "moleculer-db": "^0.8.4", "moleculer-db-adapter-mongo": "^0.4.7", "nats": "^1.3.2", "moleculer": "^0.14.0", "typescript": "^3.8.3", "@types/jest": "^25.1.4", "@types/mkdirp": "^1.0.0", "@types/node": "^13.9.8" }, "engines": { "node": ">= 10.x.x" }, "jest": { "coverageDirectory": "<rootDir>/coverage", "testEnvironment": "node", "moduleFileExtensions": [ "ts", "tsx", "js" ], "transform": { "^.+\.(ts|tsx)$": "ts-jest" }, "testMatch": [ "/*.spec.(ts|js)" ], "globals": { "ts-jest": { "tsConfig": "tsconfig.json" } } } }

`

cyc1e avatar Jun 07 '22 13:06 cyc1e

My temporary solution to fix it:

//moleculer.config.ts
import {
  BrokerOptions, Errors, MetricRegistry, ServiceBroker,
} from 'moleculer';

interface UpdatedBrokerOptions extends BrokerOptions {
  replCommands: any;
}
...
const brokerConfig: UpdatedBrokerOptions = {
...
  replCommands: [],
...
}

s2dent avatar Jun 29 '22 11:06 s2dent