Loopback-next: Build Script Issue

Created on 21 Aug 2019  路  4Comments  路  Source: strongloop/loopback-next


I have found a strange issue with build script after using cli commands

Steps to reproduce


1- lb4 applicationName
2- npm start
3- lb4 datasource
4- lb4 repository
5- lb4 model
6- lb4 controller

I followed cli instructions then

7- npm start
8- Removing dist folder
9- npm start gave an error Error: Cannot find module './dist'
10- npm run build no thing happened and dist folder won't be created

Current Behavior


After running npm start this happened

[email protected] prestart /media/poode/58080579314E4682/Projects/backend/todo-api
 npm run build


 [email protected] build /media/poode/58080579314E4682/Projects/backend/todo-api
 lb-tsc


 [email protected] start /media/poode/58080579314E4682/Projects/backend/todo-api
 node -r source-map-support/register .

Error: Cannot find module './dist'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/media/poode/58080579314E4682/Projects/backend/todo-api/index.js:1:21)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

Expected Behavior

building from src folder with overwriting to tsconfig.tsbuildinfo file, hence dist folder will be created again and server will run again.

Additional information


OS is linux
Node Version is 8.16.0

Note:

  • I removed this file tsconfig.tsbuildinfo.The build script works again and dist folder created, and server started again.
bug

Most helpful comment

Thanks now I made a trifle change in packages.scripts.prestart to be "prestart": "npm run clean && npm run build",

All 4 comments

https://github.com/strongloop/loopback-next/issues/3358#issuecomment-514658504

Try updating lb4. Issue has been resolved, see above.

I am using latest package

Can you see if the advice given by Raymond in the linked thread helps?

Thanks now I made a trifle change in packages.scripts.prestart to be "prestart": "npm run clean && npm run build",

Was this page helpful?
0 / 5 - 0 ratings