0

node_modules is installed but after build the live application get problems that was not present on local machine

  • I have an server running Ubuntu OS which I use to a Vue.js application.
  • When I npm install and npm build on server the live application get some problems of design and functionality (in my MacBook it works perfectly).
  • The only solution I got to make it works was to replace the server node_modules folder with the node_modules folder that is in my another PC (that uses Ubuntu too).
  • This problem is blocking me of using new packages in the project.

If someone could help me I would be very glad.

package.json

{
  "version": "2.0.0",
  "private": true,
  "scripts": {
    "dev": "vue-cli-service serve --open",
    "free_dev": "vue-cli-service serve --open --mode free_development",
    "staging": "vue-cli-service serve --open --mode staging",
    "free_staging": "vue-cli-service serve --open --mode free_staging",
    "build_staging": "vue-cli-service build --mode staging",
    "build_free_staging": "vue-cli-service build --mode free_staging",
    "build_production": "vue-cli-service build --mode production",
    "build_free_production": "vue-cli-service build --mode free_production",
    "lint": "vue-cli-service lint",
    "build_production-report": "vue-cli-service build --mode production --report",
    "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'",
    "now-start": "vue-cli-service serve",
    "test:e2e": "vue-cli-service test:e2e",
    "test:unit": "vue-cli-service test:unit"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "core-js": "^2.6.10",
    "firebase": "^6.6.2",
    "moment": "^2.24.0",
    "prerender-spa-plugin": "^3.4.0",
    "v-money": "^0.8.1",
    "vue": "^2.6.10",
    "vue-head": "^2.1.2",
    "vue-i18n": "^8.15.0",
    "vue-router": "^3.0.3",
    "vue-the-mask": "^0.11.1",
    "vuetify": "^2.1.6",
    "vuetify-toast-snackbar": "^0.6.1",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.12.1",
    "@vue/cli-plugin-e2e-cypress": "^3.12.1",
    "@vue/cli-plugin-eslint": "^3.12.1",
    "@vue/cli-plugin-unit-jest": "^3.12.1",
    "@vue/cli-service": "^3.12.1",
    "@vue/eslint-config-standard": "^4.0.0",
    "@vue/test-utils": "1.0.0-beta.29",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.6.0",
    "compression-webpack-plugin": "^3.1.0",
    "eslint": "^5.16.0",
    "eslint-config-vuetify": "*",
    "eslint-plugin-vue": "^5.0.0",
    "node-sass": "^4.13.0",
    "pug": "^2.0.4",
    "pug-plain-loader": "^1.0.0",
    "sass": "^1.23.1",
    "sass-loader": "^7.3.1",
    "vee-validate": "^2.2.15",
    "vue-chartist": "^2.2.1",
    "vue-cli-plugin-eslint-config-vuetify": "latest",
    "vue-cli-plugin-i18n": "^0.6.0",
    "vue-cli-plugin-vuetify": "^1.1.1",
    "vue-cli-plugin-vuetify-essentials": "^0.7.0",
    "vue-template-compiler": "^2.6.10",
    "vue-world-map": "^0.1.1",
    "vuetify-loader": "^1.2.2",
    "webpack-bundle-analyzer": "^3.6.0"
  }
}
Gabryell
  • 1
  • 1
  • 1

2 Answers2

1

Make sure that you copy your package-lock.json file to your server as well and not only package.json. That way you will ensure that npm installs exactly the same versions of all packages on your server as the ones that were installed locally.

You can read more about the package-lock.json file here.

You copy your package-lock.json file over at any point and running npm install will ensure that your node modules are all at the correct versions.

D Malan
  • 10,272
  • 3
  • 25
  • 50
0
  • Try removing node_modules from the server and do npm install again
  • Make sure the node and npm versions -- however this shouldn't be the issue
  • Remove package.lock file if exist and do npm install again
  • Make sure you don't have any errors while downloading dependencies
Hardik Raval
  • 3,406
  • 1
  • 26
  • 28