loopback4-example-microservices icon indicating copy to clipboard operation
loopback4-example-microservices copied to clipboard

example doesn't run

Open danielpiedra opened this issue 6 years ago • 12 comments

Description/Steps to reproduce

git clone https://github.com/strongloop/loopback-next-example
cd loopback-next-example
npm run build
npm start

Expected result

app example runs

Additional information

/Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:296
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
controllers/TransactionController.ts (1,10): Module '"/Users/danielq/Projects/Playground/loopback-next-example/services/transaction/node_modules/@loopback/core/index"' has no exported member 'api'. (2305)
    at getOutput (/Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:296:15)
    at /Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:325:16
    at Object.compile (/Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:479:11)
    at Module.m._compile (/Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:379:43)
    at Module._extensions..js (module.js:584:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/danielq/Projects/Playground/loopback-next-example/node_modules/ts-node/src/index.ts:382:12)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)

danielpiedra avatar Oct 02 '17 18:10 danielpiedra

Same here, but with different controller:

/home/christoph/sources/loopback/loopback-next-example/node_modules/ts-node/src/index.ts:307
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
controllers/AccountManagementController.ts (1,10): Module '"/home/christoph/sources/loopback/loopback-next-example/services/facade/node_modules/@loopback/core/index"' has no exported member 'api'. (2305)
    at getOutput (/home/christoph/sources/loopback/loopback-next-example/node_modules/ts-node/src/index.ts:307:15)

node version is 7.7.4

choeller avatar Oct 11 '17 11:10 choeller

import { api } from '@loopback/core'; same error

apapacy avatar Oct 11 '17 12:10 apapacy

Install loopback/rest package for all services with npm install @loopback/rest --save

then replace import { api } from '@loopback/core'; by import { api } from '@loopback/rest';

and it should work

wolrajhti avatar Oct 18 '17 09:10 wolrajhti

thank you

apapacy avatar Oct 18 '17 10:10 apapacy

So. Im install @loopback/rest (4-alpha-3) And bow have new error message

Cannot start the app. Error: The key http.port was not bound to any value. at FacadeMicroservice.getBinding (/home/andrey/projects/loopback-next-example/services/facade/node_modules/@loopback/context/src/context.ts:153:11)

Is this repository active status?

apapacy avatar Oct 18 '17 10:10 apapacy

I solved this by adding the following in "services/facade/index.ts" at line 9 : const app = this; app.bind('http.port').to(3004);

it seems to work but I don't understand next steps. It seems that app.start() starts all the Server of the application which seems not yet implemented..

Do you have the following messages when you run npm run build ? npm WARN [email protected] No repository field npm WARN [email protected] No repository field npm WARN [email protected] No repository field npm WARN [email protected] No repository field

Maybe the problem is here.

I'm still looking how to launch this example too

wolrajhti avatar Oct 18 '17 13:10 wolrajhti

module.js:540 throw err; ^

Error: Cannot find module 'D:\loopback-next-example' at Function.Module._resolveFilename (module.js:538:15) at Function.Module._load (module.js:468:25) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3

same here not running

suryacaprice avatar Feb 27 '18 11:02 suryacaprice

@shimks , could you PTAL to see if the problem still exists after this PR had landed? thanks.

dhmlau avatar Apr 17 '18 15:04 dhmlau

Last time I checked, the repo's able to start, but not everything is functional. See https://github.com/strongloop/loopback4-example-microservices/issues/94 for more details

shimks avatar Apr 17 '18 16:04 shimks

any news on this issue with loopback GA version?

ex7r3me avatar Oct 12 '18 23:10 ex7r3me

@ex7r3me @suryacaprice @wolrajhti @apapacy @danielpiedra, sorry that we haven't been updating this repo. We've changed quite a lot since the last update. For now, if you would like to get some working example, you can the sample apps under https://github.com/strongloop/loopback-next/tree/master/examples, or a closer-to-real-life application: https://github.com/strongloop/loopback4-example-shopping.

I'd bring it up to the team on what's the best way to handle this repo. Thanks!

dhmlau avatar Oct 14 '18 03:10 dhmlau

@dhmlau Hi, Isn't the best for the community just to close this repo if it is not working? I just wasted some time trying to get it to work ;( Thank you

AntonioAsr avatar Oct 27 '19 16:10 AntonioAsr