0

I have been running the same Loopback 4 projects on my PC for months, but a couple of days ago I start getting Typescript problems that I cannot find a resolution to.

When trying to run NPM START, I'm getting the following Typescript:

node_modules/@loopback/core/dist/src/keys.d.ts(27,40): error TS1005: '>' expected. node_modules/@loopback/core/dist/src/keys.d.ts(27,103): error TS1109: Expression expected. node_modules/@loopback/rest/dist/src/router/trie-router.d.ts(11,62): error TS1144: '{' or ';' expected. node_modules/@loopback/rest/dist/src/router/trie-router.d.ts(12,5): error TS1128: Declaration or statement expected. node_modules/@loopback/rest/dist/src/router/trie-router.d.ts(12,39): error TS1005: ';' expected. node_modules/@loopback/rest/dist/src/router/trie-router.d.ts(13,1): error TS1128: Declaration or statement expected.

The same code (project) runs just fine on another PC, so I'm thinking this is related to Typescript, but I have not been able to figure out the root cause, and therefore find a resolution on my own.

Update: I tried to run NPM UPDATE on my working environment, and it broke too, with the same TS-problems.

Maybe it's my package.json file, it was scaffolded using an beta-version of LB4, and manually updated.

"@loopback/boot": "^1.0.5",
"@loopback/context": "^1.1.0",
"@loopback/core": "^1.1.0",
"@loopback/openapi-v3": "^1.1.2",
"@loopback/openapi-v3-types": "^1.0.1",
"@loopback/repository": "^1.0.5",
"@loopback/rest": "^1.3.1",
"@loopback/rest-explorer": "^1.1.1",
"@loopback/service-proxy": "^1.0.2",
LarsM
  • 59
  • 4

1 Answers1

1

So - I finally figured out the reason behind my problems.

My project was scaffolded with an early version of the Loopback/cli back in July 2018, and the logic regarding the \dist folder was changed in index.js.

Some time during the last couple of weeks, a new logic has replaced the old dist-util, and this change broke my project.

I'm back now, but I have one un-resolved issue with the query parameter of Restbindings being empty. I will open a new thread for that.

LarsM
  • 59
  • 4
  • While giving a useful hint you should clarify your answer with the solution: Update the dependencies! I ran into the same problem. – p13n Dec 01 '18 at 16:52
  • Ok, so my problem was primarily caused by the build-logic being changed in the GA release. In the pre-release setup, the @loopback/dist-util determined if the prod-files should go to dist8 or dist10, while the GA version is using \dist regardless. My fix was to create a new app with the cli from the GA release, and replace my old index.js file with the new one. Hope this helps. – LarsM Dec 02 '18 at 17:19