Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to locally build an ionic app taken from a .git repository

I was trying to build Moodle's ionic mobile app locally on Windows by following the below steps:

cd project-directory

ionic platform add android

The command prompt returns the below error:

Updated the hooks directory to have execute permissions
Adding android project...
Running command: cmd "/s /c "C:\Users\zameer\.cordova\lib\npm_cache\cordova-andr
oid\4.1.1\package\bin\create.bat D:\ionic\moodlemobile2-master\moodlemobile2-mas
ter\platforms\android com.moodle.moodlemobile "Moodle Mobile" --cli""
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.moodle.moodlemobile
        Name: Moodle Mobile
        Activity: MainActivity
        Android target: android-22
Copying template files...
Android project created with [email protected]
Running command: "C:\Program Files\nodejs\node.exe" D:\ionic\moodlemobile2-maste
r\moodlemobile2-master\hooks\after_prepare\010_add_platform_class.js D:\ionic\mo
odlemobile2-master\moodlemobile2-master
add to body class: platform-android
Running command: "C:\Program Files\nodejs\node.exe" D:\ionic\moodlemobile2-maste
r\moodlemobile2-master\hooks\after_prepare\020_add_ios_transport_security.js D:\
ionic\moodlemobile2-master\moodlemobile2-master
module.js:338
    throw err;
          ^
Error: Cannot find module 'plist'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object. (D:\ionic\moodlemobile2-master\moodlemobile2-master\ho
oks\after_prepare\020_add_ios_transport_security.js:10:13)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
Error: Hook failed with error code 1: D:\ionic\moodlemobile2-master\moodlemobile
2-master\hooks\after_prepare\020_add_ios_transport_security.js

Everything seems normal till the below part of the above error block:

throw err;
      ^
Error: Cannot find module 'plist'

My aim is to run this project locally to see ionic in action

What is this plist module? Why is it not getting detected?

like image 709
xameeramir Avatar asked Dec 18 '22 20:12

xameeramir


2 Answers

After cloning a Git repository that contains a Ionic app, you need to run these 2 additional commands:

Install Node.js dependencies

npm install

It will install all the Node.js dependencies in the local node_modules folder. The modules considered are the ones listed under dependencies and devDependencies in the package.json file located at the root of the cloned Git repository.

Install Cordova plugins

ionic state restore

This command looks at the cordovaPlugins and cordovaPlatforms attributes in the package.json file and install the additional platforms and plugins code required for the app.

like image 123
arainone Avatar answered Dec 21 '22 09:12

arainone


You did not execute npm install so you are missing the required packages.

Read this on what need to be done to work with ionic.

Go into the project folder where the package.json is in and execute the npm install form that folder.

like image 36
CodeWizard Avatar answered Dec 21 '22 09:12

CodeWizard