Cannot find module "postgraphile plugin upload field " - file-upload

i installed postgraphile-plugin-upload-field
npm i graphile-contrib/postgraphile-plugin-upload-field
then
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
throws exception like this.
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'
]
}
and here is another situation if i remove #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
here is the error:
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 )

Related

AWS Amplify: How to install sharp in Lambda Trigger?

I am new to using AWS Amplify and AWS Lambda and
I'm facing a problem that I can't solve on my own.
Explanation:
I ran the command:
amplify add storage
This command generated for me the trigger below:
exports.handler = async function (event) {
console.log('Received S3 event:', JSON.stringify(event, null, 2));
const bucket = event.Records[0].s3.bucket.name;
const key = event.Records[0].s3.object.key;
console.log(`Bucket: ${bucket}`, `Key: ${key}`);
};
What I want to do?
I would like to resize the images that are uploaded to my bucket.
What's the problem?
My problem is that I can't install sharp package.
Because of yarn, I cannot run this command:
npm install sharp
With npm, I get this error (remove package-lock.json file don't resolve the problem):
warning package-lock.json found. Your project contains lock files
generated by tools other than Yarn. It is advised not to mix package
managers in order to avoid resolution inconsistencies caused by
unsynchronized lock files. To clear this warning, remove
package-lock.json.
So I ran this command:
yarn add sharp
But I still have errors.
I created a video that I uploaded to Youtube:
https://youtu.be/iZANbmVhhp4
Also I tested that but it's not works:
↓ ↓ ↓
https://sahanamarsha.medium.com/resizing-s3-images-with-aws-lambda-trigger-ca4cf2372d0e
https://github.com/SahanAmarsha/image-resizer-lambda/blob/master/package.json
↑ ↑ ↑
Creating thumbnails is very common and I don't understand why I can't do it.
Can you explain to me step-by-step how to do it?
So that I can understand why I can't.
Regards
Additional infos
Here is the Execution result:failed Details I get in the AWS console:
{
"errorType": "Error",
"errorMessage": "\nSomething went wrong installing the \"sharp\" module\n\nCannot find module '../build/Release/sharp-linux-x64.node'\nRequire stack:\n- /var/task/node_modules/sharp/lib/sharp.js\n- /var/task/node_modules/sharp/lib/constructor.js\n- /var/task/node_modules/sharp/lib/index.js\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js\n\nPossible solutions:\n- Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"\n- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"\n- Consult the installation documentation: https://sharp.pixelplumbing.com/install",
"trace": [
"Error: ",
"Something went wrong installing the \"sharp\" module",
"",
"Cannot find module '../build/Release/sharp-linux-x64.node'",
"Require stack:",
"- /var/task/node_modules/sharp/lib/sharp.js",
"- /var/task/node_modules/sharp/lib/constructor.js",
"- /var/task/node_modules/sharp/lib/index.js",
"- /var/task/index.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/Runtime.js",
"- /var/runtime/index.js",
"",
"Possible solutions:",
"- Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"",
"- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"",
"- Consult the installation documentation: https://sharp.pixelplumbing.com/install",
" at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:34:9)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Module.require (internal/modules/cjs/loader.js:974:19)",
" at require (internal/modules/cjs/helpers.js:101:18)",
" at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:8:1)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"
]
}
Here is the Log output I get in the AWS console:
the installation documentation: https://sharp.pixelplumbing.com/install","stack":["Error: ","Something went wrong installing the \"sharp\" module","","Cannot find module '../build/Release/sharp-linux-x64.node'","Require stack:","- /var/task/node_modules/sharp/lib/sharp.js","- /var/task/node_modules/sharp/lib/constructor.js","- /var/task/node_modules/sharp/lib/index.js","- /var/task/index.js","- /var/runtime/UserFunction.js","- /var/runtime/Runtime.js","- /var/runtime/index.js","","Possible solutions:","- Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"","- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"","- Consult the installation documentation: https://sharp.pixelplumbing.com/install"," at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:34:9)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"," at Module.load (internal/modules/cjs/loader.js:950:32)"," at Function.Module._load (internal/modules/cjs/loader.js:790:12)"," at Module.require (internal/modules/cjs/loader.js:974:19)"," at require (internal/modules/cjs/helpers.js:101:18)"," at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:8:1)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"]}
2022-10-26T03:30:59.951Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"\nSomething went wrong installing the \"sharp\" module\n\nCannot find module '../build/Release/sharp-linux-x64.node'\nRequire stack:\n- /var/task/node_modules/sharp/lib/sharp.js\n- /var/task/node_modules/sharp/lib/constructor.js\n- /var/task/node_modules/sharp/lib/index.js\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js\n\nPossible solutions:\n- Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"\n- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"\n- Consult the installation documentation: https://sharp.pixelplumbing.com/install","stack":["Error: ","Something went wrong installing the \"sharp\" module","","Cannot find module '../build/Release/sharp-linux-x64.node'","Require stack:","- /var/task/node_modules/sharp/lib/sharp.js","- /var/task/node_modules/sharp/lib/constructor.js","- /var/task/node_modules/sharp/lib/index.js","- /var/task/index.js","- /var/runtime/UserFunction.js","- /var/runtime/Runtime.js","- /var/runtime/index.js","","Possible solutions:","- Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"","- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"","- Consult the installation documentation: https://sharp.pixelplumbing.com/install"," at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:34:9)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"," at Module.load (internal/modules/cjs/loader.js:950:32)"," at Function.Module._load (internal/modules/cjs/loader.js:790:12)"," at Module.require (internal/modules/cjs/loader.js:974:19)"," at require (internal/modules/cjs/helpers.js:101:18)"," at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:8:1)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"]}
START RequestId: 0df51e26-e55f-42a0-8716-f2507ba7ff78 Version: $LATEST
END RequestId: 0df51e26-e55f-42a0-8716-f2507ba7ff78
REPORT RequestId: 0df51e26-e55f-42a0-8716-f2507ba7ff78 Duration: 2382.57 ms Billed Duration: 2383 ms Memory Size: 128 MB Max Memory Used: 15 MB
Unknown application error occurred
Error
Here is my package.json:
{
"name": "S3Triggeref35961b",
"version": "2.0.0",
"description": "Lambda function generated by Amplify",
"main": "index.js",
"license": "Apache-2.0",
"dependencies": {
"sharp": "^0.31.1"
},
"scripts": {
"amplify:S3Triggeref35961b": "cd amplify/backend/function/S3Triggeref35961b/src && npm install && rm -rf node_modules/sharp && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp && cd -"
}
}
Here is my index.js:
const sharp = require("sharp");
exports.handler = async function (event) {
console.log("Hello World!");
};

Gets ENOTDIR error when yarn start for expo project

I activated yarn by following yarn official docs (https://yarnpkg.com/getting-started/install)
I created an expo app with yarn by following react native official docs (https://reactnative.dev/docs/environment-setup)
But when I run yarn start I get below error
node:internal/errors:465
ErrorCaptureStackTrace(err);
^
Error: spawn ENOTDIR
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:700:9)
at spawn (/Users/minseok/Repository/test/.yarn/cache/cross-spawn-npm-6.0.5-2deab6c280-f893bb0d96.zip/node_modules/cross-spawn/index.js:12:24)
at run (/Users/minseok/Repository/test/.yarn/unplugged/expo-npm-46.0.10-310b54dc3f/node_modules/expo/bin/cli.js:11:12)
at Object.<anonymous> (/Users/minseok/Repository/test/.yarn/unplugged/expo-npm-46.0.10-310b54dc3f/node_modules/expo/bin/cli.js:6:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require$$0.Module._extensions..js (/Users/minseok/Repository/test/.pnp.cjs:20807:33)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.require$$0.Module._load (/Users/minseok/Repository/test/.pnp.cjs:20630:22) {
errno: -20,
code: 'ENOTDIR',
syscall: 'spawn'
}
How can I fix this?

npm --prefix <dependency path> run <lifecycle scripts> (preinstall/install/postinstall/preprepare/prepare/postprepare) fails

I am trying to manually run lifecycle scripts of node_module dependencies for a project with npm --prefix <path> run <lifecycle script> after running npm -w <workspaces> ci --ignore-scripts.
I am attaching a part of log outputs of the scripts I wrote below.
...
Running prepare in node_modules/node-fetch
sh: 1: cross-env: not found
sh: 1: cross-env: not found
Running prepare in node_modules/#graphql-eslint/eslint-plugin/node_modules/cross-fetch
sh: 1: husky: not found
sh: 1: husky: not found
Running prepare in node_modules/sync-fetch
sh: 1: browserify: not found
sh: 1: browserify: not found
Running prepare in node_modules/#iarna/toml
> #iarna/toml#2.2.5 prepare
> npm run setup-burntsushi-toml-suite && npm run setup-iarna-toml-suite
> #iarna/toml#2.2.5 setup-burntsushi-toml-suite
> [ -d test/burntsushi-toml-test ] || (git clone https://github.com/BurntSushi/toml-test test/burntsushi-toml-test; rimraf test/burntsushi-toml-test/.git/hooks/*); cd test/burntsushi-toml-test; git pull
Already up to date.
> #iarna/toml#2.2.5 setup-iarna-toml-suite
> [ -d test/spec-test ] || (git clone https://github.com/iarna/toml-spec-tests -b 0.5.0 test/spec-test; rimraf test/spec-test/.git/hooks/*); cd test/spec-test; git pull
Already up to date.
Running prepare in node_modules/camel-case
Running prepare in node_modules/pascal-case
Running prepare in node_modules/yargs
Running prepare in node_modules/lower-case
Running prepare in node_modules/no-case
Running prepare in node_modules/#graphql-tools/utils/node_modules/camel-case
Running prepare in node_modules/send/node_modules/mime
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
...
Running prepare in /node_modules/#storybook/addon-actions
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
...
Based on the log, it seems like npm --prefix <path> run <lifecycle script> is often trying to run scripts that does not exist or use commands not installed, and thus fails.
Since some lifecycle scripts removes some codes and tries to rebuild them, I am also failing to build services in my root project.
I was suspecting this might be because
npm ci uses hoisting
dependencies have outdated lifecycle scripts in their package.json's
but after thinking, I don't think neither would be the case and this shouldn't be happening, because npm runs lifecycle scripts after npm ci in the background, and I was able to build services successfully when I used npm -w <workspaces> ci

Failed to install reactide " Error: Cannot find module 'vs/editor/contrib/gotoSymbol/goToCommands' "

I try to install reactide on Windows 10. After cloning its git repository and installing dependencies. When I run the command npm run webpack-production I get the following errors:
C:\reactide(3.0-release -> origin) (reactide#3.0.0)
λ npm run webpack-production
> reactide#3.0.0 webpack-production
> webpack --mode production
C:\reactide\node_modules\webpack-cli\bin\cli.js:281
throw err;
^
Error: Cannot find module 'vs/editor/contrib/gotoSymbol/goToCommands'
Require stack:
- C:\reactide\node_modules\monaco-editor-webpack-plugin\out\index.js
- C:\reactide\webpack.config.js
- C:\reactide\node_modules\webpack-cli\bin\utils\convert-argv.js
- C:\reactide\node_modules\webpack-cli\bin\cli.js
- C:\reactide\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.resolve (C:\reactide\node_modules\v8-compile-cache\v8-compile-cache.js:164:23)
at resolveMonacoPath (C:\reactide\node_modules\monaco-editor-webpack-plugin\out\index.js:34:28)
at C:\reactide\node_modules\monaco-editor-webpack-plugin\out\index.js:173:63
at Array.map (<anonymous>)
at createLoaderRules (C:\reactide\node_modules\monaco-editor-webpack-plugin\out\index.js:173:43)
at MonacoEditorWebpackPlugin.apply (C:\reactide\node_modules\monaco-editor-webpack-plugin\out\index.
at webpack (C:\reactide\node_modules\webpack\lib\webpack.js:51:13)
at processOptions (C:\reactide\node_modules\webpack-cli\bin\cli.js:272:16)
at C:\reactide\node_modules\webpack-cli\bin\cli.js:364:3
at Object.parse (C:\reactide\node_modules\yargs\yargs.js:576:18)
at C:\reactide\node_modules\webpack-cli\bin\cli.js:49:8
at Object.<anonymous> (C:\reactide\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\reactide\node_modules\webpack\bin\webpack.js:156:2)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\reactide\\node_modules\\monaco-editor-webpack-plugin\\out\\index.js',
'C:\\reactide\\webpack.config.js',
'C:\\reactide\\node_modules\\webpack-cli\\bin\\utils\\convert-argv.js',
'C:\\reactide\\node_modules\\webpack-cli\\bin\\cli.js',
'C:\\reactide\\node_modules\\webpack\\bin\\webpack.js'
]
}
npm ERR! code 1
npm ERR! path C:\reactide
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "webpack --mode production"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2022-07-08T13_47_50_402Z-debug.log
I tried looking for the solution on this GitHub page and this stack overflow question but no success. I have installed all the dependencies.
The error occurs in monaco-editor-webpack-plugin used in webpack.config.js:
plugins: [
new MonacoWebpackPlugin(),
],
I found this issue in official repo with a similar error and I fixed the problem like this:
plugins: [
new MonacoWebpackPlugin({
features: ["!gotoSymbol"],
languages: ["!abap"],
}),
],

How do I fix this error on my React Native Yarn

When I run yarn start this error is showing with error command failed with exit code. How can I solve this?
yarn run v1.22.18
$ node -r #babel/register ./.erb/scripts/check-port-in-use.js && yarn start:renderer
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '#babel/register'
Require stack:
- internal/preload
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at Module._preloadModules (node:internal/modules/cjs/loader:1282:12)
at loadPreloadModules (node:internal/bootstrap/pre_execution:539:5)
at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:85:3)
at node:internal/main/run_main_module:7:1 {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]