Home > OS >  Error during the build on the Plesk server with my Nuxt app
Error during the build on the Plesk server with my Nuxt app

Time:05-24

I have a Vue Storefront 2 project with Magento 2 as it CMS. Locally everything runs fine. When I try to run NPM install on my Plesk server before I can build and deploy it, it gives the following error:

npm ERR! code 1
npm ERR! path /var/www/vhosts/vuestorefront2.dev/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! linux-x64-node-16 exists; testing
npm ERR! Problem with the binary; manual build incoming
npm ERR! stdout=
npm ERR! err=Error: Command failed: /opt/plesk/node/16/bin/node quick-test.js
npm ERR! /var/www/vhosts/vuestorefront2.dev/node_modules/bindings/bindings.js:135

I have tried to remove all references of deasync in my package-lock.json. Even though NPM install then runs and allows me to build to project afterwards, it did not load any products from Magento anymore on the deployed instance. Locally I do however fetch and display products succesfully.

CodePudding user response:

When you have an issue regarding a build remotely, the first step is usually to build it locally (with something like npm run build, then run it locally npm run start) to be sure if it's a Nuxt issue or a hosting/platform issue.

Here, it looked like OP could fix his problem by forcing a specific endpoint to use the production URL. Maybe he is lacking some local server.

This fixed the issue

publicRuntimeConfig: {
  middlewareUrl: process.env.NODE_ENV === "production"
    ? "https://example.com/api/" // Your production URL
    : "http://localhost:3000/api/",
}
  • Related