nextjs page not found after deployment - deployment

I created a simple nextjs app using create-next-app
I added only some pages in pages folder (contact.js, help.js)
I can build and start app in localhost using below commands
npm run build
npm run start
this is script part of package.json
"scripts": {
"dev": "node server.js",
"build": "cross-env next build",
"start": "cross-env NODE_ENV=production node server.js",
"lint": "next lint"
},
I deployed this app on a shared host with plesk control panel
index page is ok,
but it not found help and contact pages
neither by typing url directly in address bar, nor clicking in Link (next/link)
.next folder content:
.next/server folder content:
.next/server/pages folder content:
at first I set Application Startup File to
node_modules/.bin/next
and tried run start script but it didn't work, so to start app
I set Application Startup File to: customserver.js in plesk like below:
Custom Server
what can be wrong here?
any ideas?

Related

nw-builder - NWJS win64 app built using nw-builder does not run my code, only shows default NWJS splash screen

I am attempting to build my first NWJS app for win64. I'm using MacOS 10.13.6 . After a rough start and updating npm and node, I finally ran a build which completed without errors. I downloaded the app package to my Windows machine, however when I run the .exe file, the app opens displaying the NWJS splash screen, instead of loading my code. Any ideas?
Root directory I'm running in:
10:50:50 : ~/ReolinkNWJS
ls
dist icons javascript package-lock.json package.json.TEMPLATE src
html images node_modules package.json resources styles
Do the build:
10:51:01 : ~/ReolinkNWJS
npm run prod
> ReolinkNWJS#0.0.1 prod
> nwbuild --platforms win64 --buildDir dist/ ./
Latest Version: v0.65.0
Using v0.65.0 (sdk)
Create cache folder in /Users/kevin/ReolinkNWJS/node_modules/nw-builder/cache/0.65.0-sdk
Using cache for: win64
Create release folder in /Users/kevin/ReolinkNWJS/dist/ReolinkNWJS/win64
Resulting win32 directory:
12:47:48 : ~/ReolinkNWJS
ls dist/ReolinkNWJS/win32
ReolinkNWJS.exe d3dcompiler_47.dll icudtl.dat locales notification_helper.exe nw_200_percent.pak payload.exe swiftshader vk_swiftshader_icd.json
chromedriver.exe debug.log libEGL.dll nacl_irt_x86_64.nexe nw.dll nw_elf.dll pnacl v8_context_snapshot.bin vulkan-1.dll
credits.html ffmpeg.dll libGLESv2.dll node.dll nw_100_percent.pak nwjc.exe resources.pak vk_swiftshader.dll
I downloaded the complete win64 directory to my Windows machine, then executed the containing ReolinkNWJS.exe file. As I stated, I only got the NWJS default splash screen, not my app.
package.json:
{
"name": "ReolinkNWJS",
"description": "Reolink Client App In NWJS Framework",
"version": "0.0.1",
"icon": "icons/app.icns",
"main": "html/main.html",
"chromium-args": "--enable-logging=stderr --enable-spell-checking",
"window": {
"toolbar": false,
"width": 800,
"height": 500,
"position": "center"
},
"nodejs": true,
"scripts": {
"prod": "nwbuild --platforms win64 --buildDir dist/ ./"
},
"devDependencies": {
"nw": "^0.12.0",
"nw-builder": "^3.7.0"
}
}
for nwbuild part:
nwbuild --platforms win64 --buildDir dist/ ./
add in the flavour below may solve the issue:
--mode build
This might be related to the issue you're encountering, since you're both using WINE: https://github.com/nwutils/nw-builder/pull/572#issuecomment-1144416689

npm run build error in nextJS and vercel deploy

I have an app already deploy on vercel , i change just a a content in a page and push it on git without problem(i make that many times without problem before), but now i can't execute npm run build return an error , the same error on vercel deploy.
Can any one help me to fix this issue.
00:50:06.011 > next .next/build
00:50:06.209 > No such directory exists as the project root: /vercel/workpath0/portfolio/.next/build
the script in package.json
"scripts": {
"dev": "next dev",
"build": "next .next/build",
"start": "next start"
},
vercel deploy terminal
The reason its failing with "No such directory exists" is because the .next directory doesn't exist until you run next build, which is the command that generates the output.
Change your build script to next build, like it shows in the Next.js docs, and it will work.

Build error on Ionic Pro build process

I am batting to get a successful build on IonicJs when I push my code up to the Ionic Git remote.
My application sits in a subfolder on the root directory of my repository. At first when I execute “npm run build” on the root the build process was telling me it could not find my package.json file. After reading the ionic docs (https://ionicframework.com/docs/pro/basics/concepts/customizing-builds.html) I noticed that in the case of an app being in a sub folder you need to place another package.json file in the root of your repository. I did this and the above error was solved and the build process worked on my local machine. But when I push the changes up to the Ionic Js for building it tells me that its “Missing ionic.config.json in app.”
Here is the package.json file I placed in the root of my repository.
{
"author": "",
"name": "io.cordova.myappe070fb",
"private": true,
"version": "0.1.0",
"scripts": {
"install": "cd App && npm install",
"build": "cd App && .\\node_modules\\.bin\\ionic-app-scripts build --prod"
}
}
`
My questions:
Is there a way to configure the package.json file in the root of the repository so that when Ionic runs “npm run build” it will build based on the package.json file in the App folder.
How do I solve the problem regarding the missing ionic.config.json error that is being generated by ionic.
Kind regards
Andrew

Ionic add custom script with ionic serve

I am using Ionic 3 via CLI.
While using ionic serve I want to add custom scripts "auth" which:
Prompts for username and password
creates cookie using api, and uses this cookie while calling each API.
My Gruntfile.js
I've created custom server task in grunt which:
Prompts the user for login
Creates cookies and applies this cookie with each request.
Is able to manage run with ionic from package.json.
grunt.registerTask('server', ['checkAuthToken', 'applyAuthToken', 'configureRewriteRules', 'configureProxies']);
"scripts": { "auth": "grunt server", }
Now I am wondering how to import this auth task before ionic serve so that my proxy and authentication works.
Scripts in my package.json
I tried with below npm-script in my package.json. It prompts for username, password, and creates cookies, however my proxy doesn't work because my grunt task is run after ionic watch and before ionic build.
...
"ionic:serve": "ionic-app-scripts serve && grunt server",
"ionic:serve": "grunt server && ionic-app-scripts serve"
...
Hi if you have ionic cli then you use ionic:build:before in your scripts section of package.json.
Example: package.json
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"ionic:build:before": "grunt server"
}

Error with Spawned command: npminstall

I am trying to run a sample application from
https://ionicframework.com/getting-started/.
But I am getting the error - there was an error with the spawned process: npminstall every time I try to run the application. Any help is highly appreciated.
For me it was only to upgrade to new version of npm
npm install -g npm
Spawned command error comes when you try to start a new ionic or cordova app, that gets downloaded from git. This error occurs because your network proxy blocks download a new blank app from git.
To avoid such kind of error try removing the proxies.
1. If you are in a company using their proxy its not possible to do that, so use your own data to do that.
Try downloading a blank app from git using your own data, don't use company network which has proxy enabled.
It will download but while installing the app you will get error like:
Error with start undefined.
Error with spawned command npminstall.
Don't worry a folder will be downloded,
Go to cmd and go inside that app directory and run ionic serve
It will give error like ionic.config.json file didn't find.
create a file with the name ionic.config.json inside the app file.
inside that file paste the following:
{ "name": "your app name", "app_id": "", "v2": true, "typescript": true }
now try running the command ionic serve
your app will run.
I had the similar problem but it worked for me.
install npm globally
npm install -g npm
create a app without installing its packages
ionic start app --v2 --skip-npm
seems ok till now?then
cd app
install packages
npm install --save
done!try to start your ionic app
ionic serve