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
Related
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
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?
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.
I have a problem deploying Ionic 4 app to Github pages.
I tried follwing a tutorial for uploading Angular app but it does not work. It keeps throwing errors of all kinds.
Does anyone can help?
Thanks a lot.
Here is how to use angular-cli-ghpages with Ionic 4:
Create your Ionic project (ionic start MyApp blank)
Install the plugin: npm i angular-cli-ghpages --save
Connect your project with your github repository.
Navigate in the terminal to your project directory and execute ionic build --prod -- --base-href https://YOUR_GITHUB_USERNAME.github.io/YOUR_PROJECT_NAME/, what will create the www folder, which is comparable to the dist folder for Angular. It also sets your github page domain as base href in index.html.
Then run the plugin: npx angular-cli-ghpages --dir=www. The flag at the end points to the www folder, where the index.html file is located that will be displayed at https://YOUR_GITHUB_USERNAME.github.io/YOUR_PROJECT_NAME/. The plugin will create a branch called "gh-pages" in your project that contains all files which are located in your www folder.
As a last step you have to select the "gh-page" branch in the settings of your project (https://YOUR_GITHUB_USERNAME.github.io/YOUR_PROJECT_NAME/settings) as a source for your github page.
You can also set different branch names if you don't want to use the default "gh-pages" name (also master is possible, but then you should keep the source files in a different branch). Just run the plugin like this: npx angular-cli-ghpages --branch=BRANCH-NAME --dir=www.
Like Gary Großgarten suggested, you can create a script for it which makes it easier. For Ionic it would be: ionic build --prod -- --base-href https://YOUR_GITHUB_USERNAME.github.io/YOUR_PROJECT_NAME/ && npx angular-cli-ghpages --branch=BRANCH-NAME --dir=www
I was looking for a proper solution myself, credits go to Juangui Jordán's blog.
I'm using https://github.com/angular-schule/angular-cli-ghpages to achieve this easily.
Just add
"scripts": {
...
"gh-pages": "ng build --base-href 'https://USERNAME.github.io/REPOSITORY_NAME/' --prod && npx ngh --dir=www/"
...
}
to your package.json.
If you want a costum domain you can add the cname flag
--cname=example.com
to the ngh command.
To build and upload your site run
npm run gh-pages
Just a note: For a gitlab repository (not Github) you can do this:
.gitlab-ci.yml:
pages:
image: node:latest
stage: deploy
script:
- npm install -g ionic cordova
- npm install
# frontend application is served at https://what-digital.gitlab.io/stemba/
# we need to set the basePath to the sub dir
- ionic build --prod -- --base-href="https://what-digital.gitlab.io/gitlab-pages/"
- rm -rf public
- mkdir public
- cp -r www/* public
artifacts:
expire_in: 1 week
paths:
- public
only:
- dev
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