将PKG与featherjs应用程序一起使用

时间:2018-08-29 22:53:30

标签: feathersjs zeit-pkg

有人曾经尝试将pkgfeatherjs一起使用吗?我无法使其正常工作。

运行可执行文件时出现以下错误:

WARNING: No configurations found in configuration directory:/../project/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
pkg/prelude/bootstrap.js:1172
      throw error;
      ^

TypeError: root path required
    at Function.serveStatic [as static] (/snapshot/../project/node_modules/serve-static/index.js:40:11)

如果有人有任何指导,不确定从这里去哪里。

"bin": "src/index.js",
"scripts": {
  "test": "npm run eslint && npm run mocha",
  "dev": "./node_modules/nodemon/bin/nodemon.js src/",
  "eslint": "eslint src/. test/. --config .eslintrc.json",
  "mocha": "mocha test/ --recursive --exit",
  "start": "node src/",
  "pkg": "pkg . -t node9-macos-x64 --out-path pkg"
},
"pkg": {
  "assets": [
    "src/**/*",
    "public/**/*",
    "config/**/*",
    "node_modules/config/**/*.*"
  ],
  "scripts": [
    "src/**/*.js",
    "config/**/*.json"
  ]
},

1 个答案:

答案 0 :(得分:0)

错误来自node-config使用的@feathersjs/configuration,后者试图从运行的应用程序的文件夹而不是捆绑的软件包中加载config/default.json。您可以尝试将NODE_CONFIG环境变量设置为config/defualt.json的内容来构建,也可以删除应用程序所需的app.configure(configuration())app.set配置选项,例如通过要求{{ 1}}(也应在打包环境中工作):

config/default.json