Ionic Pro: Build Failed "missing script: build"

PhoneGap Build me thinks for you

i did try, today at morning, but, not works, sorry

For ionic1 project solved by adding missing lines to package.json:

   ...
    "scripts": {
        "build": "ls"
    },
   ...
2 Likes

like that?

{
“name”: “app”,
“version”: “0.0.1”,
“description”: “An Ionic project”,
“devDependencies”: {
“gulp”: “^3.5.6”,
“gulp-clean-css”: “^3.7.0”,
“gulp-rename”: “^1.2.0”,
“gulp-sass”: “^3.1.0”
}
“scripts”: {
“build”: “ls”
},
}

Try like this:

{
    "name": "app",
    "version": "0.0.1",
    "description": "An Ionic project",
    "devDependencies": {
        "gulp": "^3.5.6",
        "gulp-clean-css": "^3.7.0",
        "gulp-rename": "^1.2.0",
        "gulp-sass": "^3.1.0"
    },
    "scripts": {
        "build": "ls"
    },
    "dependencies": {
        "cordova-android": "^6.2.3",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.1",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-plugin-keyboard": "^2.2.1"
    }
}

Whhyyyyyy! :frowning:
I can confirm your solution worked for me! :smiley:

I’m still getting the same build failed error with this package.json:

{
    "name": "myapp",
    "version": "0.0.1",
    "description": "An Ionic project",
    "devDependencies": {
        "gulp": "^3.5.6",
        "gulp-clean-css": "^3.7.0",
        "gulp-rename": "^1.2.0",
        "gulp-sass": "^3.1.0"
    },
    "scripts": {
        "build": "ls"
    },	
    "dependencies": {
        "cordova-plugin-console": "^1.1.0",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.1",
        "cordova-plugin-whitelist": "^1.3.1",
        "onesignal-cordova-plugin": "^2.2.0"
    },
    "cordova": {
        "plugins": {
            "onesignal-cordova-plugin": {},
            "cordova-plugin-console": {},
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-whitelist": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {}
        }
    }
}

Guys, my app is works!!!

{
“name”: “app”,
“version”: “0.0.1”,
“description”: “An Ionic project”,
“devDependencies”: {
“gulp”: “^3.5.6”,
“gulp-clean-css”: “^3.7.0”,
“gulp-rename”: “^1.2.0”,
“gulp-sass”: “^3.1.0”
},
“scripts”: {
“build”: “ls”
},
“dependencies”: {
“cordova-android”: “^6.2.3”,
“cordova-ios”: “^4.4.0”,
“cordova-plugin-console”: “^1.0.5”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.1”,
“cordova-plugin-whitelist”: “^1.3.1”,
“ionic-plugin-keyboard”: “^2.2.1”
}
}

that’s my package.json

Copy/paste your full error log

keithsinclairltd Copy/paste your full error log

Here is my error log:

Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
  on IonicJS Snapshot Runner (6c67ff43)
Using Shell executor...
Running on ip-10-2-21-14...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/6c67ff43/0/project-1'...
Checking out XXXXXXXX as master...
Skipping Git submodules setup
$ fetch-updates
Checking for build process updates...
$ build-app
Fetching build dependencies...
Detected www/ directory commited to version control. Assuming Ionic 1 app.
Running: npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

> node-sass@4.5.3 install /usr/src/app/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-57_binding.node
Download complete
Binary saved to /usr/src/app/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /home/gitlab-runner/.npm/node-sass/4.5.3/linux-x64-57_binding.node

> node-sass@4.5.3 postinstall /usr/src/app/node_modules/node-sass
> node scripts/build.js

Binary found at /usr/src/app/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
npm WARN myapp@0.0.1 No repository field.
npm WARN myapp@0.0.1 No license field.

added 359 packages in 26.306s
npm install succeeded
Running: npm run build
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm ERR! missing script: build

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitlab-runner/.npm/_logs/2017-09-26T10_58_29_495Z-debug.log
/snapshot.sh: line 32: [: missing `]'
npm run build failed
Make sure your project has a build script in the package.json
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1

I am completely new to Ionic and even git, so if it’s something obvious please be kind :slight_smile:

This totally works for me. Thanks a lot!

Hey keithsinclairltd.
first of all open your app folder, then open package.json file

you will find something like this in it, it may be more or less but still the same way of content

{
“name”: “testApp”,
“version”: “0.0.1”,
“description”: “An Ionic project”,
“devDependencies”: {
"@ionic/app-scripts": “^2.1.4”,
"@ionic/cli-plugin-proxy": “1.4.11”,
“gulp”: “^3.5.6”,
“gulp-clean-css”: “^3.7.0”,
“gulp-rename”: “^1.2.0”,
“gulp-sass”: “^3.1.0”
},
“dependencies”: {
“jsxc”: “^0.10.0”
}
}

then you have to add those lines in this file

“scripts”: {
“build”: “ls”
}


my file after edit it is look like this

{
“name”: “testApp”,
“version”: “0.0.1”,
“description”: “An Ionic project”,
“devDependencies”: {
"@ionic/app-scripts": “^2.1.4”,
"@ionic/cli-plugin-proxy": “1.4.11”,
“gulp”: “^3.5.6”,
“gulp-clean-css”: “^3.7.0”,
“gulp-rename”: “^1.2.0”,
“gulp-sass”: “^3.1.0”
},
“scripts”: {
“build”: “ls”
},
“dependencies”: {
“jsxc”: “^0.10.0”
}
}

I hope my comment helps you, if there’s anything obvious please tell me

Hi Ibrahim,

Thanks for your reply, I have added those lines in my package file, I posted the contents of my package.json above in post 27, does it look correct to you?

Thanks

Yeah it worked well with me.

have you commit your changes and push it to github and ionic dashboard?!

This has worked for me now thanks.

Thank you Ibrahim. Your suggestion helped me fix the same issue!

1 Like

My package.json has this in there already:


"scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },

I worry about removing all that and replacing it with:

“scripts”: {
    “build”: “ls”
}

Any advice?

Follow up:

I made the proposed edit and the build still failed. This time the error was:

Running: npm run build
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm info lifecycle ionic-hello-world@~prebuild: ionic-hello-world@
npm info lifecycle ionic-hello-world@~build: ionic-hello-world@

> ionic-hello-world@ build /usr/src/app
> ls

config.xml
ionic.config.json
node_modules
package.json
package-lock.json
resources
src
tsconfig.json
tslint.json
npm info lifecycle ionic-hello-world@~postbuild: ionic-hello-world@
npm info ok 
Build failed: No www/ directory detected
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1

@jeremyy7 To me it seems that you do not have a www/ directory (from the error message). I’m not sure; I would have just created one www/ directory in your app directory to see if it helps.

have you created a blank app or what ?!