我安装了 postgraphile-plugin-upload-field
npm i graphile-contrib/postgraphile-plugin-upload-field
然后
postgraphile -c 'postgres://postgres:mysecretpass@192.168.38.4:5432/gimapp' --cors -p 5001 --enhance-graphiql --host "0.0.0.0" -s messages,basic_auth,user --append-plugins @graphile/postgis,@graphile-contrib/pg-simplify-inflector,postgraphile-plugin-connection-filter,@graphile-contrib/postgraphile-plugin-upload-field --watch --no-ignore-indexes --jwt-token-identifier basic_auth.jwt_token --jwt-secret mysecretpass
像这样抛出异常。
Failed to load plugin '@graphile-contrib/postgraphile-plugin-upload-field'
/usr/lib/node_modules/postgraphile/build/postgraphile/cli.js:268
throw e;
^
Error: Cannot find module '@graphile-contrib/postgraphile-plugin-upload-field'
Require stack:
- /usr/lib/node_modules/postgraphile/build/postgraphile/cli.js
- /usr/lib/node_modules/postgraphile/cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at /usr/lib/node_modules/postgraphile/build/postgraphile/cli.js:263:20
at Array.map (<anonymous>)
at loadPlugins (/usr/lib/node_modules/postgraphile/build/postgraphile/cli.js:255:18)
at Object.<anonymous> (/usr/lib/node_modules/postgraphile/build/postgraphile/cli.js:323:23)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/node_modules/postgraphile/build/postgraphile/cli.js',
'/usr/lib/node_modules/postgraphile/cli.js'
]
}
如果我删除@graphile-contrib,这是另一种情况
postgraphile -c 'postgres://postgres:mysecretpass@192.168.38.4:5432/gimapp' --cors -p 5001 --enhance-graphiql --host "0.0.0.0" -s messages,basic_auth,user --append-plugins @graphile/postgis,@graphile-contrib/pg-simplify-inflector,postgraphile-plugin-connection-filter,postgraphile-plugin-upload-field --watch --no-ignore-indexes --jwt-token-identifier basic_auth.jwt_token --jwt-secret mysecretpass
这是错误:
PostGraphile v4.10.0 server listening on port 5001
Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for full error (see: https://graphile.org/postgraphile/debugging )
> TypeError: Cannot read property 'filter' of undefined…
Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for full error (see: https://graphile.org/postgraphile/debugging )