Next JS deployment fail on Amazon Amplify ERR - next.js

I am trying to deploy an SSG app on Next JS but it's failing again and again I am getting an error of build failed. I have followed the documentation for deploying an SSG site on amazon but still, I am getting errors I don't know what's wrong.
Below is the log of my amplify app:
en
# Starting phase: preBuild
# Executing command: npm ci
2022-10-19T06:14:55.093Z [WARNING]: npm
2022-10-19T06:14:55.095Z [WARNING]: ERR! caniuse-lite not accessible from browserslist
2022-10-19T06:14:55.129Z [WARNING]:
2022-10-19T06:14:55.129Z [WARNING]: npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-10-19T06_14_55_093Z-debug.log
2022-10-19T06:14:55.129Z [HELP]: Outputting the npm debug log
[object Promise]
2022-10-19T06:14:55.135Z [ERROR]: !!! Build failed
2022-10-19T06:14:55.135Z [ERROR]: !!! Non-Zero Exit Code detected
2022-10-19T06:14:55.135Z [INFO]: # Starting environment caching...
2022-10-19T06:14:55.137Z [INFO]: # Environment caching completed
Terminating logging...

Related

Can I build my Next Js project inside cpanel

I need to build my next js project inside the cpanel so I dont have to build it locally and upload it every time.
I tried running the build script in the cpanel using the "setup Node.js app" and this is the error I get :
client#0.1.0 build /home/bazztn/front
next build
info - Using webpack 5. Reason: Enabled by default
https://nextjs.org/docs/messages/webpack5 info - Checking validity of
types... stderr: events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn /opt/alt/alt-nodejs14/root/usr/bin/node EAGAIN
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) Emitted 'error' event on
ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) { errno: -11, code:
'EAGAIN', syscall: 'spawn /opt/alt/alt-nodejs14/root/usr/bin/node',
path: '/opt/alt/alt-nodejs14/root/usr/bin/node', spawnargs: [
'/home/bazztn/nodevenv/front/14/lib/node_modules/jest-worker/build/workers/processChild.js'
] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client#0.1.0
build: next build npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the client#0.1.0 build 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!
/home/bazztn/.npm/_logs/2022-04-10T16_24_44_597Z-debug.log
You should be fully able to do so. I am personally hosting a Nuxt and Next projects on a cPanel host without none issues so far.
The easiest way to deploy any NodeJS app is to use CloudLinux's NodeJS Selector and the good part of it is that you can also choose which Node version to be used for your app (no matter the server's default node version or whatsoever).
Having that said, I would highly recommend you just find a cPanel host which does come with the NodeJS feature.

next js error build : next build not working because error css

Hello I try to build my project but it gives me errors.I am being told precisely about a webpack error
adgroupe#0.1.0 build C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe
next build
info - Checking validity of types
info - Creating an optimized production build
Failed to compile.
HookWebpackError: C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\static\css\93f817412a0f74ff.css:801:13: Unknown word
at makeWebpackError (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\compiled\webpack\bundle5.js:41664:9)
at C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\compiled\webpack\bundle5.js:25354:12
at eval (eval at create (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\compiled\webpack\bundle5.js:140346:10), :34:1)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
-- inner error --
CssSyntaxError: C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\static\css\93f817412a0f74ff.css:801:13: Unknown word
at Input.error (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\input.js:148:16)
at ScssParser.unknownWord (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:522:22)
at ScssParser.other (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:149:12)
at ScssParser.parse (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:59:16)
at scssParse (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:322)
at new LazyResult (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\lazy-result.js:133:16)
at Processor.process (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\processor.js:28:14)
at CssMinimizerPlugin.optimizeAsset (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\build\webpack\plugins\css-minimizer-plugin.js:43:12)
at C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\build\webpack\plugins\css-minimizer-plugin.js:77:55
at runMicrotasks ()
caused by plugins in Compilation.hooks.processAssets
CssSyntaxError: C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\static\css\93f817412a0f74ff.css:801:13: Unknown word
at Input.error (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\input.js:148:16)
at ScssParser.unknownWord (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:522:22)
at ScssParser.other (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:149:12)
at ScssParser.parse (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\parser.js:59:16)
at scssParse (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:322)
at new LazyResult (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\lazy-result.js:133:16)
at Processor.process (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\node_modules\postcss\lib\processor.js:28:14)
at CssMinimizerPlugin.optimizeAsset (C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\build\webpack\plugins\css-minimizer-plugin.js:43:12)
at C:\Users\alain\Documents\PROJECTS\ADGROUPE\adgroupe\node_modules\next\dist\build\webpack\plugins\css-minimizer-plugin.js:77:55
at runMicrotasks ()
Build failed because of webpack errors
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! adgroupe#0.1.0 build: next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the adgroupe#0.1.0 build 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! C:\Users\alan\AppData\Roaming\npm-cache_logs\2022-04-03T09_05_40_524Z-debug.log

Problem starting Next.js app at locallhost 7777 using yarn dev

When I try to run my localhost using yarn dev it shows this error:
yarn run v1.22.4 $ next -p 7777 ready - started server on
0.0.0.0:7777, url: http://localhost:7777 TypeError: _jestWorker.Worker is not a constructor
at Object.loadWebpackHook (D:\isc-web\isc-front\node_modules\next\dist\server\config-utils.js:67:20)
at Object.loadConfig [as default] (D:\isc-web\isc-front\node_modules\next\dist\server\config.js:332:29)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async NextServer.loadConfig (D:\isc-web\isc-front\node_modules\next\dist\server\next.js:112:22)
error Command failed with exit code 1. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command.
It was all working fine before I did npm install --save-dev babel-plugin-styled-components even though I canceled the changes by using git checkout -- . but still got the same problem
If you cancelled dependency changes with git checkout your node_modules may still have the old dependencies installed. Try running npm i again to see if getting updated dependencies resolves the issue.
I can't tell much from this error message and I don't know how far along your project is... Have you seen the official Next.js + styled-components example? https://github.com/vercel/next.js/tree/canary/examples/with-styled-components
Perhaps if you try setting up the library this way instead?

Error canonicalCode: INVALID_ARGUMENT, "errorMessage": "`npm_install` had stderr output while firebase deploy

I'm deploying my nodeJS code with firebase, If I do firebase serve on local machine it works fine, but when I do firebase deploy it gives me multiple errors.
{"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "npm_install had stderr output.....}}
if i resolve this issue then i get.
gen_package_lock` had stderr output.
I am not able to deploy firebase.
I am using node version >12 and integrated firebase with that. Stuck on this,
Tried with removing package-lock.json as well.
ERROR:-
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "npm_install had stderr output:\nnpm ERR! cb() never called!\n\nnpm ERR! This is an error with npm itself. Please report this error at:\nnpm ERR! https://npm.community\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2019-12-13T07_06_14_773Z-debug.log\n\nerror: npm_install returned code: 1", "errorType": "InternalError", "errorId": "8042D85F"}}
Expecting some solutions to resolve this issue.
Thanks

Potential conflict between polymer build and tur-nr/polymer-redux

Description
I am experiencing unexpected errors when running polymer build after installing and using tur-nr/polymer-redux. Here is the demo repo.
Versions & Environment
polymer-build: v0.18.3 polymer --version
node: v6.10.2
Operating System: macOS Sierra v10.12.4
Steps to reproduce
terminal
git clone https://github.com/maria-le/redux # clone remote repo to your local
cd redux # cd into your local repo
bower install # install bower dependencies
npm install redux # install redux
polymer build # attempt build
Expected results
I expect the build to complete, without errors. Then allow me to serve the packaged build.
Actual results
I get the following errors in the terminal.
Error messages
src/all-locally.html(14,16) error [unknown-polymer-behavior] - Unable to resolve behavior store. Did you import it? Is it annotated with #polymerBehavior?
ReduxStore
src/imported-behavior.html(7,16) error [unknown-polymer-behavior] - Unable to resolve behavior ReduxStore. Did you import it? Is it annotated with #polymerBehavior?
polymerStore
src/imported-store-as-variable.html(10,16) error [unknown-polymer-behavior] - Unable to resolve behavior polymerStore. Did you import it? Is it annotated with #polymerBehavior?
PolymerRedux(reduxStore)
src/imported-store.html(7,16) warning [could-not-determine-behavior-name] - Could not determine behavior name from expression of type
CallExpression
error: Promise rejection: Error: 3 error(s) occurred during build.
error: Error: 3 error(s) occurred during build.
at BuildAnalyzer._done (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:229:36)
at BuildAnalyzer. (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:189:26)
at next (native)
at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:17:58)
at process._tickCallback (internal/process/next_tick.js:109:7)
References
How to use polymer-redux with polymer-build?
polymer lint and polymer-build fail due to ReduxBehavior not registering properly
#polymerBehavior should still produce a behavior even if we can't evaluate the expression

Resources