I have an older app I am transitioning to Rails 7. I created a new app and Im essentially putting the gemfiles, controllers, models, and views that I used on the previous app. I keep seeing this error when I run $rails assets:precompile and I have the coffee gem for rails installed (comes preinstalled) but it list all my coffee files and says a loader is not configured. How do I configure a loader and where am I placing the file to load?
#terminal
rails assets:precompile
yarn install v1.22.19
[1/4] ๐ Resolving packages...
success Already up-to-date.
โจ Done in 0.10s.
yarn run v1.22.19
$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/coupon.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/bills.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/welcome.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/landing.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/dashboard.js.coffee
โ [ERROR] Could not resolve "controllers/application"
app/javascript/controllers/index.js:3:28:
3 โ import { application } from "controllers/application"
โต ~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "controllers/application" as external to exclude it from the bundle, which
will remove this error.
6 of 7 errors shown (disable the message limit with --log-limit=0)
node:child_process:879
throw err;
^
Error: Command failed: /Users/Public/code/LDv1.1/node_modules/esbuild-darwin-64/bin/esbuild app/javascript/application.js app/javascript/bills.js.coffee app/javascript/coupon.js.coffee app/javascript/dashboard.js.coffee app/javascript/landing.js.coffee app/javascript/rails.validations.js app/javascript/welcome.js.coffee --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
at checkExecSyncError (node:child_process:841:11)
at Object.execFileSync (node:child_process:876:15)
at Object.<anonymous> (/Users/Public/code/LDv1.1/node_modules/esbuild/bin/esbuild:177:28)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 9665,
stdout: null,
stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
rails aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)
P.S. When I run yarn build as the terminal says I get this error...
yarn build
yarn run v1.22.19
$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/welcome.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/bills.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/landing.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/coupon.js.coffee
โ [ERROR] No loader is configured for ".coffee" files: app/javascript/dashboard.js.coffee
โ [ERROR] Could not resolve "controllers/application"
app/javascript/controllers/index.js:3:28:
3 โ import { application } from "controllers/application"
โต ~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "controllers/application" as external to exclude it from the bundle, which
will remove this error.
6 of 7 errors shown (disable the message limit with --log-limit=0)
node:child_process:879
throw err;
^
Error: Command failed: /Users/Public/code/LDv1.1/node_modules/esbuild-darwin-64/bin/esbuild app/javascript/application.js app/javascript/bills.js.coffee app/javascript/coupon.js.coffee app/javascript/dashboard.js.coffee app/javascript/landing.js.coffee app/javascript/rails.validations.js app/javascript/welcome.js.coffee --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
at checkExecSyncError (node:child_process:841:11)
at Object.execFileSync (node:child_process:876:15)
at Object.<anonymous> (/Users/Public/code/LDv1.1/node_modules/esbuild/bin/esbuild:177:28)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 10205,
stdout: null,
stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Related
2022-08-19T20:07:05.596Z [INFO]:
> NX Successfully ran target puppy-client:build:production for project myProject
2022-08-19T20:07:05.597Z [INFO]:
2022-08-19T20:07:05.597Z [INFO]: > NX Cannot find configuration for task myProject:myProject:build:production
Error: Cannot find configuration for task myProject:myProject:build:production
at getExecutorNameForTask (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/utils.js:125:15)
at getExecutorForTask (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/utils.js:131:22)
at getCustomHasher (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/utils.js:137:21)
at TasksSchedule.<anonymous> (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/tasks-schedule.js:114:62)
at Generator.next (<anonymous>)
at /codebuild/output/src765821316/src/workspace/node_modules/tslib/tslib.js:118:75
at new Promise (<anonymous>)
at Object.__awaiter (/codebuild/output/src765821316/src/workspace/node_modules/tslib/tslib.js:114:16)
at TasksSchedule.hashTask (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/tasks-schedule.js:113:24)
at TasksSchedule.<anonymous> (/codebuild/output/src765821316/src/workspace/node_modules/nx/src/tasks-runner/tasks-schedule.js:61:24)
2022-08-19T20:07:05.614Z [ERROR]: !!! Build failed
2022-08-19T20:07:05.614Z [ERROR]: !!! Non-Zero Exit Code detected
2022-08-19T20:07:05.615Z [INFO]: # Starting environment caching...
2022-08-19T20:07:05.615Z [INFO]: # Environment caching completed
Terminating logging...
Does anyone have any experience deploying an Nx repo to AWS Amplify? I can't seem to use --verbose to print the error out in my build settings.
# build settings
version: 1
# backend:
# phases:
# build:
# commands:
# - '# Execute Amplify CLI with the helper script'
# - amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm i -g nx
- yarn install
build:
commands:
- nx build myProject --prod --verbose
artifacts:
baseDirectory: dist/apps/puppy-client/.next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- libs/**/*
Edit: running build works fine on my machine, no compilation errors.
I have been able to get around and make Next.js apps a lot as of late. However, something changed and I cannot seem to find a solution to my issue. I run npx create-next-app <app name> and it hits me with an error and only creates the package.json. It then shows me this error. Any insight would be appreciated.
>npx create-next-app imageuploads3
Creating a new Next.js app in /Users/Jeremy!##$%^%$#/Desktop/Code For Learning/imageuploads3.
Using yarn.
Installing dependencies:
- react
- react-dom
- next
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn yarn ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn yarn',
path: 'yarn',
spawnargs: [
'add',
'--exact',
'--cwd',
'/Users/jeremy!##$^%$#/Desktop/Code For Learning/imageuploads3',
'react',
'react-dom',
'next'
]
}
Node.js v17.8.0
IIOS 12.3
npx create-react-app works just fine BTW.
It's because Yarn isn't enabled. You have two options:
If you want to use NPM instead of Yarn, pass the --use-npm flag in:
$ npx create-next-app --use-npm myapp
For Yarn, enable Corepack first:
$ corepack enable
$ npx create-next-app myapp
These are my yaml files referenced by here (kubernetes.io/docs)
deployment gists
And I use command kubectl apply -f backend-deployment.yaml -f frontend-configmap.yaml -f frontend-deployment.yaml
Backend were launched successfully, but Frontend occured error.
[emerg] 1#1: host not found in upstream "backend-service" in /etc/nginx/conf.d/nginx.conf:2
#nginx: [emerg] host not found in upstream "backend-service" in /etc/nginx/conf.d/nginx.conf:2
Even if 'backend-service' is declared, nginx couldn't recognize it.
Command nslookup backend-service result is:
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find backend-service: SERVFAIL
What am I missing?
I have gotten closer to the issue/solution.
First of all, you if the images in your supplied answer are correct, you are running nginx in your backend deployment and node-js server on your frontend deployment. This is a mistake.
after changing the images frontend is running (as expected) but backend pod is crashing.
However, the backend pod is successfully resolving the mysql-service to its internal clusterIp and I appear to have wrong authentication setup.
`> server#1.0.0 start /usr/src/app
> node backend.js
(node:18) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:18) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:18) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
listening on 3000
events.js:292
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 10.100.77.32:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1142:16)
--------------------
at Protocol._enqueue (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/usr/src/app/node_modules/mysql/lib/Connection.js:116:18)
at Object.<anonymous> (/usr/src/app/backend.js:58:12)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/usr/src/app/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Handshake.<anonymous> (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:153:12)
at Handshake.emit (events.js:315:20)
at Handshake.Sequence.end (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:78:12)
at Protocol.handleNetworkError (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:369:14)
at Connection._handleNetworkError (/usr/src/app/node_modules/mysql/lib/Connection.js:418:18)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:96:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '10.100.77.32',
port: 3306,
> node backend.js
fatal: true
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#1.0.0 start: `node backend.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#1.0.0 start 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! /root/.npm/_logs/2021-07-21T08_46_32_833Z-debug.log`
if you look at the log. it says it tries to connect to 10.100.77.32:3306 and the output of kubectl get svc is the following mysql-service ClusterIP 10.100.77.32 <none> 3306/TCP 17m
with the matching ip of my service.
kubectl get endpoints shows that the mysql-service has indeed found an endpoint:
mysql-service ClusterIP 10.100.77.32 <none> 3306/TCP 17m
and here is additional log information showing that the authentication mechanism of your nodejs application appearently is not working for the mysql pod.
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/usr/src/app/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/usr/src/app/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/usr/src/app/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/usr/src/app/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:296:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
--------------------
at Protocol._enqueue (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/usr/src/app/node_modules/mysql/lib/Connection.js:116:18)
at Object.<anonymous> (/usr/src/app/backend.js:58:12)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/usr/src/app/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Handshake.<anonymous> (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:153:12)
at Handshake.emit (events.js:315:20)
at Handshake.Sequence.end (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:78:12)
at Handshake.ErrorPacket (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:125:8)
at Protocol._parsePacket (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:291:23)
[... lines matching original stack trace ...]
at readableAddChunk (_stream_readable.js:272:9) {
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#1.0.0 start: `node backend.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#1.0.0 start 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! /root/.npm/_logs/2021-07-21T08_55_22_133Z-debug.log
However, with the changes suggest at the beginning of the answer the issues around resolving the service name and communicating inside of kubernetes should be resolved.
backend-deployment image : bateaux/test-nginx
frontend-deployment image : bateaux/test-node-server
When deploy backend-deployment, remove [livenessProbe, readinessProbe].
Because node.js express server use #cloudnative/health-connect To readinessProbe, so call PingCheck(worker node ip).
Wow....I found solution for getaddrinfo EAI_AGAIN mysql-service.
I think if network can't find service, there is error in dns.
kubectl logs --namespace=kube-system -l k8s-app=kube-dns
Result of command is gist.
So...I finally found this link about kubernetes coredns.
By belphegor's answer, it works restart coredns.
Although, there is new error Client does not support authentication protocol requested by server; consider upgrading MySQL client, but i think to solve it is easier than dns error. hhhhhhhhhhhhhhhh
I have a Gridsome site that I'm trying to deploy to AWS Amplify.
The site builds fine and with no errors locally with gridsome build, however on AWS Amplify, it fails.
I initially thought the error was related to a non-SSR component I was using that required <ClientOnly> tags, as this was throwing warnings in my local build. However, I've since removed that component and the issue persists.
I also thought the issue may be due to some outdated dependencies being required by packages related to webpack, but after several hours of trying to resolve these, I'm relatively confident this is not the case.
I don't quite understand the error log, but I think the issue may be related to the large number of images on my website, and AWS Amplify running out of memory (ENOMEM) while processing them. I haven't been able to find a way to increase the memory allocation for AWS Amplify, if this is even the cause.
The AWS Amplify log provides the following information:
2020-04-23T14:21:23.331Z [WARNING]: Gridsome v0.7.14
2020-04-23T14:21:23.867Z [WARNING]: Initializing plugins...
2020-04-23T14:21:24.053Z [WARNING]: Load sources - 0.1s
2020-04-23T14:21:24.166Z [WARNING]: Create GraphQL schema - 0.11s
2020-04-23T14:21:24.200Z [WARNING]: Create pages and templates - 0.03s
2020-04-23T14:21:24.224Z [WARNING]: Generate temporary code - 0.02s
2020-04-23T14:21:24.224Z [WARNING]: Bootstrap finish - 0.89s
2020-04-23T14:21:24.226Z [WARNING]: Compiling assets...
2020-04-23T14:28:43.461Z [WARNING]: Compile assets - 439.23s
2020-04-23T14:28:43.487Z [WARNING]: Execute GraphQL (14 queries) - 0.03s
2020-04-23T14:28:43.492Z [WARNING]: Write out page data (14 files) - 0s
2020-04-23T14:28:45.196Z [WARNING]: Render HTML (14 files) - 1.7s
2020-04-23T14:28:45.198Z [WARNING]: Process files (0 files) - 0s
2020-04-23T14:28:45.563Z [INFO]: [2K
2020-04-23T14:28:45.563Z [INFO]: [1GProcessing images (7675 images) - 0%
2020-04-23T14:28:47.487Z [INFO]: [2K
2020-04-23T14:28:47.489Z [INFO]: [1GProcessing images (7675 images) - 0%
2020-04-23T14:28:47.579Z [INFO]: [2K[1G
2020-04-23T14:28:47.579Z [INFO]: Processing images (7675 images) - 1%
2020-04-23T14:28:48.834Z [INFO]: [2K[1GProcessing images (7675 images) - 1%
...
2020-04-23T14:33:25.168Z [INFO]: [2K[1GProcessing images (7675 images) - 41%
2020-04-23T14:33:26.901Z [WARNING]: internal/child_process.js:366
throw errnoException(err, 'spawn');
^
Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:366:11)
at spawn (child_process.js:551:9)
at Object.fork (child_process.js:113:10)
at ChildProcessWorker.initialize (/codebuild/output/src926123643/src/website/node_modules/jest-worker/build/workers/ChildProcessWorker.js:105:44)
at ChildProcessWorker.onExit (/codebuild/output/src926123643/src/website/node_modules/jest-worker/build/workers/ChildProcessWorker.js:204:12)
at ChildProcess.emit (events.js:198:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
2020-04-23T14:33:27.254Z [WARNING]: npm
2020-04-23T14:33:27.254Z [WARNING]: ERR! code ELIFECYCLE
npm ERR! errno 1
2020-04-23T14:33:27.255Z [WARNING]: npm
2020-04-23T14:33:27.259Z [WARNING]: ERR! website# build: `gridsome build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the website# build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-23T14:33:27.270Z [WARNING]:
2020-04-23T14:33:27.270Z [WARNING]: npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-23T14_33_27_259Z-debug.log
2020-04-23T14:33:27.270Z [HELP]: Outputting the npm debug log
0 info it worked if it ends with ok
1 verbose cli [ '/root/.nvm/versions/node/v10.16.0/bin/node',
1 verbose cli '/root/.nvm/versions/node/v10.16.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.9.0
3 info using node#v10.16.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle website#~prebuild: website#
6 info lifecycle website#~build: website#
7 verbose lifecycle website#~build: unsafe-perm in lifecycle true
8 verbose lifecycle website#~build: PATH: /root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src926123643/src/website/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6#global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v10.16.0/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle website#~build: CWD: /codebuild/output/src926123643/src/website
10 silly lifecycle website#~build: Args: [ '-c', 'gridsome build' ]
11 silly lifecycle website#~build: Returned: code: 1 signal: null
12 info lifecycle website#~build: Failed to exec build script
13 verbose stack Error: website# build: `gridsome build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid website#
15 verbose cwd /codebuild/output/src926123643/src/website
16 verbose Linux 4.14.165-103.209.amzn1.x86_64
17 verbose argv "/root/.nvm/versions/node/v10.16.0/bin/node" "/root/.nvm/versions/node/v10.16.0/bin/npm" "run" "build"
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error website# build: `gridsome build`
22 error Exit status 1
23 error Failed at the website# build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
2020-04-23T14:33:27.291Z [ERROR]: !!! Build failed
2020-04-23T14:33:27.292Z [ERROR]: !!! Non-Zero Exit Code detected
2020-04-23T14:33:27.292Z [INFO]: # Starting environment caching...
2020-04-23T14:33:27.296Z [INFO]: # Environment caching completed
Terminating logging...
My package.json contains the following:
{
"name": "website",
"private": true,
"scripts": {
"build": "gridsome build",
"develop": "gridsome develop",
"explore": "gridsome explore"
},
"dependencies": {
"#gridsome/source-filesystem": "^0.6.2",
"#gridsome/transformer-remark": "^0.5.0",
"gridsome": "^0.7.14",
"gridsome-plugin-gtm": "^0.1.1",
"marked": "^0.8.0",
"vue-burger-menu": "^2.0.4",
"vue-easy-lightbox": "^0.11.0",
"vue-slick-carousel": "^1.0.5"
},
"devDependencies": {
"node-sass": "^4.13.1",
"normalize.css": "^8.0.1",
"sass-loader": "^8.0.2",
"style-resources-loader": "^1.3.3"
},
"browserslist": [
"defaults"
]
}
I'd be grateful for any help in trying to resolve this issue.
Thank you in advance.
UPDATE #1
I am now quite sure this is due to the large number of images being processed on my site via <g-image>.
I decided to try to build using AWS CodeBuild to see if I got any more information. It failed too, but did give me some more helpful errors.
When I removed all but a handful of images, the build works. Once I get above ~300 images being displayed at different dimensions, things start to fail. The error messages:
Process files (0 files) - 0s
...
[2Kยท[1GProcessing images (4671 images) - 58%Error: Failed to process image src/assets/media/jobs/1.jpg. spawn ENOMEM
at pMap.concurrency (/codebuild/output/src132267748/src/github.com/xxxxx/website/node_modules/gridsome/lib/workers/image-processor.js:113:13)
(sharp:31795): GLib-CRITICAL **: 04:50:22.507: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:31795): GLib-CRITICAL **: 04:50:22.516: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(sharp:31795): GLib-CRITICAL **: 04:50:22.516: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(sharp:31795): GLib-CRITICAL **: 04:50:22.516: g_hash_table_lookup: assertion 'hash_table != NULL' failed
So, yeah, I guess this is a Gridsome bug?
UPDATE #2
Adding node-options=--max_old_space_size=4096 in the .npmrc file causes the build to hang and eventually timeout.
UPDATE #3
Batch resized images so the max width/height was 2000px (effective max file size of ~2MB). Builds are now succeeding.
Hopefully someone can assist with a solution so we can build from the source files without pre-processing images.
This appears to be a bug where Gridsome runs out of memory processing a large number of large files.
This workaround preprocesses all of the image files in order to reduce the load of each image before Gridsome tries to process them.
Preprocess images with Sharp
// image-preprocessor.js
const fs = require("fs");
const path = require("path");
const sharp = require("sharp");
const dirPath = "./src/assets/";
const maxWidth = 2000;
const maxHeight = 2000;
const getAllFiles = function(dirPath, arrayOfFiles) {
files = fs.readdirSync(dirPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(function(file) {
if (fs.statSync(`${dirPath}/${file}`).isDirectory()) {
arrayOfFiles = getAllFiles(`${dirPath}/${file}`, arrayOfFiles);
} else {
arrayOfFiles.push(path.join(__dirname, dirPath, "/", file));
}
});
return arrayOfFiles;
};
const result = getAllFiles(dirPath);
result.forEach(async (file) => {
await sharp(`${file}`)
.resize(maxWidth, maxHeight, {
fit: "inside",
})
.toBuffer(function(err, buffer) {
fs.writeFile(`${file}`, buffer, function(err) {
if (err) {
console.log(err);
}
});
});
});
Add the image preprocesser to the builspec
// buildspec.yml
...
build:
commands:
- node image-preprocessor.js
- npm run build
...
Note that because the preprocessing is done every time Gridsome is built via the buildpsec, the source images remain untouched in the repository (and ultimately await a proper fix to this issue).
I am experiencing failure every time I try to deploy to either an AWS/EC2 instance or a Digital Ocean droplet. With the EC2 instance I am using a pem file and with the droplet I am using password access. There were a lot of hoops to jump through to get through the mup setup, but that is finally successful on both instances. It's the mup deploy that fails on the Invoking deployment process: step.
Here's my mup.json for the droplet:
{
// Server authentication info
"servers": [
{
"host": "xx.xx.xx.xx",
"username": "root",
"password": "notmypassword"
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa"
//"pem": "/users/alex/dropbox/awspems/projectmanager.pem"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number.
"nodeVersion": "0.10.35",
// Install PhantomJS in the server
"setupPhantom": true,
// Application name (No spaces)
"appName": "projectmanager",
// Location of app (local directory)
"app": "/users/alex/dropbox/projectmanager",
// Configure environment
"env": {
"ROOT_URL": "http://xx.xx.xx.xx"
},
// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 30
}
The following messages appear whether in the EC2 instance or the droplet instance:
Claire-MacAir-7:projectmanager alex$ mup deploy
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
โ Checkout Kadira!
It's the best way to monitor performance of your app.
Visit: https://kadira.io/mup โ
Building Started: /users/notmyusername/dropbox/projectmanager
Started TaskList: Deploy app 'projectmanager' (linux)
[xx.xx.xx.xx] - Uploading bundle
[xx.xx.xx.xx] โ Uploading bundle: SUCCESS
[xx.xx.xx.xx] - Setting up Environment Variables
[xx.xx.xx.xx] โ Setting up Environment Variables: SUCCESS
[xx.xx.xx.xx] - Invoking deployment process
[xx.xx.xx.xx] โ Invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
ir=/root/.node-gyp/0.10.35',
gyp info spawn args '-Dmodule_root_dir=/opt/projectmanager/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gyp info ok
npm WARN package.json meteor-dev-bundle#0.0.0 No description
npm WARN package.json meteor-dev-bundle#0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle#0.0.0 No README data
stop: Unknown instance:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
App did not pick up! Please check app logs.
-----------------------------------STDOUT-----------------------------------
LE(target) Release/obj.target/bcrypt_lib.node: Finished
COPY Release/bcrypt_lib.node
make: Leaving directory `/opt/projectmanager/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build'
> fibers#1.0.1 install /opt/projectmanager/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
underscore#1.5.2 node_modules/underscore
semver#4.1.0 node_modules/semver
chalk#0.5.1 node_modules/chalk
โโโ escape-string-regexp#1.0.2
โโโ ansi-styles#1.1.0
โโโ supports-color#0.2.0
โโโ strip-ansi#0.3.0 (ansi-regex#0.2.1)
โโโ has-ansi#0.1.0 (ansi-regex#0.2.1)
eachline#2.3.3 node_modules/eachline
โโโ type-of#2.0.1
source-map-support#0.2.8 node_modules/source-map-support
โโโ source-map#0.1.32 (amdefine#0.1.0)
fibers#1.0.1 node_modules/fibers
Waiting for MongoDB to initialize. (5 minutes)
connected
projectmanager start/running, process 11786
Waiting for 30 seconds while app is booting up
Checking is app booted or not?
----------------------------------------------------------------------------
Completed TaskList: Deploy app 'projectmanager' (linux)
The project works perfectly with no errors on my localhost.
Any ideas?
Thanks in advance, Alex Adams
And the solution is:
The mup logs showed that it didn't like a path designated for a folder to hold uploaded files. I changed the app to use GridFS, thus storing the files in the database. The app deploys correctly now.