Can I build my Next Js project inside cpanel - next.js

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.

Related

Next JS deployment fail on Amazon Amplify ERR

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...

Error returning when executing the firebase deploy command. I tried some configuration options, but not worked

=== Deploying to '###'...
i deploying functions
Running command: npm --prefix "%RESOURCE_DIR%" run lint
functions# lint C:\usCloud\functions
tslint --project tsconfig.json
WARNING: C:/usCloud/functions/src/index.ts:13:10 - bodyParser is deprecated.
WARNING: C:/usCloud/functions/src/index.ts:14:10 - bodyParser is deprecated.
Running command: npm --prefix "%RESOURCE_DIR%" run build
functions# build C:\usCloud\functions
tsc
node_modules/#google-cloud/firestore/types/firestore.d.ts:23:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentData, UpdateData, Firestore, GeoPoint, Transaction, WriteBatch, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, FieldValue, FieldPath, Timestamp, v1beta1, v1, OK, CANCELLED, UNKNOWN, INVALID_ARGUMENT, DEADLINE_EXCEEDED, NOT_FOUND, ALREADY_EXISTS, PERMISSION_DENIED, RESOURCE_EXHAUSTED, FAILED_PRECONDITION, ABORTED, OUT_OF_RANGE, UNIMPLEMENTED, INTERNAL, UNAVAILABLE, DATA_LOSS, UNAUTHENTICATED, FirebaseFirestore
23 declare namespace FirebaseFirestore {
node_modules/firebase-functions-helper/node_modules/#google-cloud/firestore/types/firestore.d.ts:25:1
25 declare namespace FirebaseFirestore {
~~~~~~~
Conflicts are in this file.
node_modules/firebase-functions-helper/node_modules/#google-cloud/firestore/types/firestore.d.ts:25:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentData, UpdateData, Firestore, GeoPoint, Transaction, WriteBatch, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, FieldValue, FieldPath, Timestamp, v1beta1, v1, OK, CANCELLED, UNKNOWN, INVALID_ARGUMENT, DEADLINE_EXCEEDED, NOT_FOUND, ALREADY_EXISTS, PERMISSION_DENIED, RESOURCE_EXHAUSTED, FAILED_PRECONDITION, ABORTED, OUT_OF_RANGE, UNIMPLEMENTED, INTERNAL, UNAVAILABLE, DATA_LOSS, UNAUTHENTICATED, FirebaseFirestore
25 declare namespace FirebaseFirestore {
node_modules/#google-cloud/firestore/types/firestore.d.ts:23:1
23 declare namespace FirebaseFirestore {
~~~~~~~
Conflicts are in this file.
node_modules/firebase-functions-helper/node_modules/#google-cloud/firestore/types/firestore.d.ts:168:5 - error TS2374: Duplicate string index signature.
168 [key: string]: any; // Accept other properties, such as GRPC settings.
~~~~~~~~~~~~~~~~~~~
Found 3 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions# build: tsc
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions# 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##\AppData\Roaming\npm-cache_logs\2020-08-26T16_49_58_562Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2

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

Resources