再做个记录哈,看到有人报这个问题,如下:
Mzc-Test:reliable Mzc$ NODE_ENV=production npm run db:seed:all
> reliable-web@1.0.0 db:seed:all /usr/local/lib/node_modules/reliable
> sequelize db:seed:all
Sequelize CLI [Node: 11.0.0, CLI: 5.5.0, ORM: 4.44.2]
Loaded configuration file "database/config.js".
Using environment "production".
ERROR: connect ECONNREFUSED 127.0.0.1:3306
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reliable-web@1.0.0 db:seed:all: `sequelize db:seed:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reliable-web@1.0.0 db:seed:all 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! /Users/Mzc/.npm/_logs/2019-07-25T09_51_47_063Z-debug.log
是因为 docker 服务没有起来导致的,需要运行下面命令启动服务才可以
docker-compose -p reliable -f docker-compose.yml up -d
走到楼主访问服务 NODE_ENV=production npm run db:seed:all
这步的时候报错了,如下图所示:
Mzc-Test:reliable Mzc$ NODE_ENV=production npm run db:seed:all
> reliable-web@1.0.0 db:seed:all /usr/local/lib/node_modules/reliable
> sequelize db:seed:all
sh: sequelize: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! reliable-web@1.0.0 db:seed:all: `sequelize db:seed:all`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the reliable-web@1.0.0 db:seed:all script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
经过询问,发现需要在 reliable 这个目录下安装 npm 依赖,命令如下:
$ cd reliable
$ cnpm i
安装完成后再次运行NODE_ENV=production npm run db:seed:all
,就可以了,
Mzc-Test:reliable Mzc$ NODE_ENV=production npm run db:seed:all
> reliable-web@1.0.0 db:seed:all /usr/local/lib/node_modules/reliable
> sequelize db:seed:all
Sequelize CLI [Node: 11.0.0, CLI: 5.5.0, ORM: 4.44.2]
Loaded configuration file "database/config.js".
Using environment "production".
== 20180815163737-add-seed-to-table-jobNames: migrating =======
item
item
item
item
finish up
== 20180815163737-add-seed-to-table-jobNames: migrated (0.017s)
== 20180815172240-add-seed-to-table-builds: migrating =======
== 20180815172240-add-seed-to-table-builds: migrated (0.040s)
== 20180816055801-add-seed-to-table-configs: migrating =======
== 20180816055801-add-seed-to-table-configs: migrated (0.005s)
这个时候去访问http://127.0.0.1:9900/
就可以看到界面了
顶一个