strongloop / loopback4-example-microservices

Deprecated - please use https://github.com/strongloop/loopback4-example-shopping/tree/master/kubernetes
http://loopback.io
Other
88 stars 28 forks source link

example doesn't run #76

Open danielpiedra opened 6 years ago

danielpiedra commented 6 years ago

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)
choeller commented 6 years ago

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

apapacy commented 6 years ago

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

wolrajhti commented 6 years ago

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

apapacy commented 6 years ago

thank you

apapacy commented 6 years ago

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?

wolrajhti commented 6 years ago

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 account@1.0.0 No repository field npm WARN customer@1.0.0 No repository field npm WARN transaction@1.0.0 No repository field npm WARN facade@1.0.0 No repository field

Maybe the problem is here.

I'm still looking how to launch this example too

suryacaprice commented 6 years ago

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

dhmlau commented 6 years ago

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

shimks commented 6 years ago

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

ex7r3me commented 5 years ago

any news on this issue with loopback GA version?

dhmlau commented 5 years ago

@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!

AntonioAsr commented 4 years ago

@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