Home > Software design >  How to run `npm run build`
How to run `npm run build`

Time:05-25

I am working in a VueJS application. I would like to deploy the application in a cPanel. I am trying to run npm run build. I am getting below error.

https://ibb.co/0Qn30TX

If I run npm run command I am getting below result.

https://ibb.co/Xp9bdDp

How can I run npm run build ?

Here is my package.json.

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "autoprefixer": "^10.2.5",
        "axios": "^0.21",
        "jquery": "^3.2",
        "laravel-echo": "^1.10.0",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "popper.js": "^1.12",
        "postcss": "^8.2.8",
        "pusher-js": "^7.0.3",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "tailwindcss": "^2.0.4",
        "vue": "^2.6.12",
        "vue-loader": "^15.9.5",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "@webzlodimir/vue-bottom-sheet": "^1.2.0",
        "moment-timezone": "^0.5.33",
        "swiper": "^6.8.0",
        "vue-awesome-swiper": "^4.1.1",
        "vue-axios": "^3.2.4",
        "vue-meta": "^2.4.0",
        "vue-moment": "^4.1.0",
        "vue-multiselect": "^2.1.6",
        "vue-notification": "^1.3.20",
        "vue-router": "^3.5.1",
        "vue-social-auth": "^1.4.9",
        "vue-social-sharing": "^3.0.8",
        "vue-spinner": "^1.0.4",
        "vue-star-rating": "^1.7.0",
        "vue-tabs-with-active-line": "^1.2.6",
        "vue2-editor": "^2.10.2",
        "vue2-timeago": "^1.2.12",
        "vuex": "^3.6.2"
    }
}

CodePudding user response:

Your app doesn't have a build command.

Looks like you've got a Laravel app; by default, it has two build commands, npm run dev (plus npm run watch, which is like npm run dev except it keeps running and re-building when your code changes, and npm run hot, which does similar but with hot-reloading), and npm run prod. Both build your front-end code, but the prod variant adds things like minification of the code.

I'd re-read the Mix docs at https://laravel.com/docs/9.x/mix#running-mix for a refresher. There's a variety of important stuff in there to be aware of.

  • Related