我有 nodejs loopback 3.x 版本的项目,我最近在 nodejs 中变成了开发人员。我已经编写了模型、服务器方面(server.js、server/root.js)等。以下是依赖项:
"dependencies" : {
"@types/async": "2.0.40",
"@types/lodash": "4.14.139",
"@types/loopback": "3.1.3",
"@types/loopback-boot": "2.23.0",
"loopback-connector-rest": "3.0.0",
"loopback-model-binder": "1.4.0",
"@types/multiparty": "0.0.31",
"rimraf": "2.6.1",
"sinon": "3.2.1",
"ts-node": "3.3.0",
"typescript": "2.8.3",
"gulp-sequence": "0.4.6",
"gulp-symlink": "2.1.4",
"gulp-typescript": "4.0.1",
"request": "2.81.0",
"shelljs": "0.8.1",
"yargs": "11.0.0",
"os-locale": "3.1.0",
"loopback-connector": "4.4.0",
"strong-globalize": "2.10.0",
"strong-remoting": "3.14.0"
}
这是我在 server.ts 中的代码片段:
const app: any = loopback();
boot(app, __dirname, (err) => {
if (err) throw err;
});
app.start = () => {
return app.listen(() => {
const BASE_URL = app.get('url').replace(/\/$/, '');
const explorer = app.get('loopback-component-explorer');
if (explorer) {
Logger.info(`Browse your REST API at ${BASE_URL}${explorer.mountPath}`);
}
});
};
以下是安装和启动应用程序的步骤:
- npm 安装
- npm 运行构建
- npm 运行开始
但是应用程序没有启动,没有错误,但在命令提示符处返回。我为命令启用了详细输出,npm run start -verbose
我发现以下内容:
loopback:datasource Module ./connectors/rest not found, will try another candidate. +10ms
loopback:datasource Initializing connector RequestBuilder +561ms
loopback:datasource Connector is initialized for dataSource rest +7ms
loopback:datasource DataSource rest is now connected to undefined +1ms
lifecycle port-app@2.0.0~start: unsafe-perm in lifecycle true
请让我知道有关上述问题的任何指示。