npm run build error in nextJS and vercel deploy - deployment

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.

Related

deployment from vercel platform using git import

I'm trying to deploy a create-react-app using vercel. I'm doing this by importing the git repository for the page. however, during the deployment process, it keeps throwing this error
[12:35:15.381] Cloning github.com/sirEmmyUche/link-shortener (Branch: main, Commit: 705a378)
[12:35:16.067] Cloning completed: 685.351ms
[12:35:16.299] Looking up build cache...
[12:35:16.431] Build Cache not found
[12:35:16.479] Running "vercel build"
[12:35:17.121] Vercel CLI 28.4.4
Error
[12:35:17.471] sh: react-scripts: command not found
[12:35:17.494] Error: Command "react-scripts build" exited with 127
The error message are the two last line of text under the error. please how do I fix this?

nextjs page not found after 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?

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

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

Build agent fails on second run for ASP.net 5 on VSO

I'm using VSO to create an automated build for a newly created ASP.NET 5 project. I followed the MSDN post and with a couple of tweaks, the following items work:
Automated build and deploy of ASP.NET project in VSO
Build and deploy of ASP.NET project from my laptop using VS 2015
What I'm trying to do is create a build agent on my laptop. I downloaded the agent.zip file and ran the powershell configuration script. When I queue the first build, VSO contacts my build agent and the build works and is published to Azure.
What does not work is the second time I queue a build. The build fails executing the following command:
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & echo $_.FullName }
The error is:
2016-02-09T17:13:50.1055064Z C:\agent\_work\1\s\MyMeds\src\MyMeds\project.json
2016-02-09T17:13:50.4535551Z ##[error]Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than
2016-02-09T17:13:50.4535551Z ##[error]260 characters, and the directory name must be less than 248 characters.
2016-02-09T17:13:50.4535551Z ##[error]At C:\agent_work\1\s\MyMeds\Prebuild.ps1:28 char:1
I would have guessed the work area would have been cleared out before the build started, but it does not seem to be the case. Also, if I manually clear the _work directory, the build succeeds. I've tried to clear the work are from within the PowerShell script, but this fails because the script is running in that directory.
Any suggestions of how to clear the work directory so that multiple builds will succeed ?
This is caused by the npm install command in the "PrePublish" script and the npm version used by VS.
"scripts": {
"prepublish": [ "npm install npm#latest", "npm version", "npm install", "bower install", "gulp clean", "gulp min" ]
}
Windows MAXPATH is limited to 260 characters while the old npm version does not apply this. The latest npm 3.x version has fixed this issue. But VS always use 1.4.9 version which cause the long path issue. See this issue for details: Update node to 5.x and npm to 3.x
The workaround for now would be remove the prepublish script from your project.json file and add additional steps in your build definition to perform these actions.