SETUP:
Ubuntu 18.04
Nodejs >= 8.9 (i tried every single version until 11.x)
Running the cmd lb4 app following the choices lead to crash when cmd npm start is executed with as output:
[email protected] prepare /home/kaso/Documents/projects/todo
npm run build[email protected] build /home/kaso/Documents/projects/todo
tsc --outDir dist --target es2017node_modules/@loopback/testlab/dist/src/skip-travis.d.ts:1:23 - error TS2688: Cannot find type definition file for 'mocha'.
1 ///
~node_modules/@loopback/testlab/dist/src/skip-travis.d.ts:8:82 - error TS2503: Cannot find namespace 'Mocha'.
8 export declare function itSkippedOnTravis(expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => TestCallbackRetval): void;
~node_modules/@loopback/testlab/dist/src/skip-travis.d.ts:8:116 - error TS2304: Cannot find name 'MochaDone'.
8 export declare function itSkippedOnTravis(expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => TestCallbackRetval): void;
~~~~~test/acceptance/home-page.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try
npm i @types/jestornpm i @types/mochaand then addjestormochato the types field in your tsconfig.5 describe('HomePage', () => {
~~~~test/acceptance/home-page.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'.
9 before('setupApplication', async () => {
~~test/acceptance/home-page.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'.
13 after(async () => {
~test/acceptance/home-page.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try
npm i @types/jestornpm i @types/mochaand then addjestormochato the types field in your tsconfig.17 it('exposes a default home page', async () => {
~~test/acceptance/home-page.acceptance.ts:24:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try
npm i @types/jestornpm i @types/mochaand then addjestormochato the types field in your tsconfig.24 it('exposes self-hosted explorer', async () => {
~~test/acceptance/ping.controller.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try
npm i @types/jestornpm i @types/mochaand then addjestormochato the types field in your tsconfig.5 describe('PingController', () => {
~~~~test/acceptance/ping.controller.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'.
9 before('setupApplication', async () => {
~~test/acceptance/ping.controller.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'.
13 after(async () => {
~test/acceptance/ping.controller.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try
npm i @types/jestornpm i @types/mochaand then addjestormochato the types field in your tsconfig.17 it('invokes GET /ping', async () => {
~~Found 12 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build:tsc --outDir dist --target es2017
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /home/kaso/.npm/_logs/2019-01-15T14_41_07_865Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prepare:npm run build
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /home/kaso/.npm/_logs/2019-01-15T14_41_07_912Z-debug.logApplication todo was created in todo.
Next steps:
$ cd todo
$ npm start
I fixed it installing npm install --save-dev @loopback/build but just following the todo tutorial letter by letter lead to a new crash when running the npm start cmd at the end of the tutorial with as output:
app.repository() function is needed for RepositoryBooter. You can add it to your Application using RepositoryMixin from @loopback/repository.
app.dataSource() function is needed for DataSourceBooter. You can add it to your Application using RepositoryMixin from @loopback/repository.
Server is running at http://127.0.0.1:3000
Try http://127.0.0.1:3000/ping
If i try a single route of todo controler i get internal server error.
Thanks by advance for the help and fix.
@KASOGIT, we just released a new version _very_ recently, and looking into why @loopback/build has been removed from the devDependencies in package.json.
For the crashing issue, @nabdelgadir, could you please take a look? I tried with lb4 example todo and seems to be working fine. It's probably related to the generated code from the latest release. Thanks.
I'm getting the same errors when using lb4 app and npm start in the app. I tried doing the same as @KASOGIT by using npm install --save-dev @loopback/build, which fixed it. As for the error from:
app.repository() function is needed for RepositoryBooter. You can add it to your Application using RepositoryMixin from @loopback/repository.
app.dataSource() function is needed for DataSourceBooter. You can add it to your Application using RepositoryMixin from @loopback/repository.
It seems to go away when changing:
export class TodoListApplication extends BootMixin(RestApplication) {
to:
import {RepositoryMixin} from '@loopback/repository';
export class TodoListApplication extends BootMixin(RepositoryMixin(RestApplication)) {
Although, I thought when Enable repositories was enabled during lb4 app, it would automatically add RepositoryMixin.
Edit: nvm found the error, fixing it in https://github.com/strongloop/loopback-next/pull/2252.
With the latest release, the problem seems to be fixed. @KASOGIT can you try again and let us know if you still have any issues?
Works great with the latest release, thanks for the quick patch :+1:
Most helpful comment
Works great with the latest release, thanks for the quick patch :+1: