'Getting "Cannot find module '/app/dist'" error on deploying to Heroku

I have the following script in my package.json:

  "scripts": {
    "dev": "nodemon server --exec babel-node --presets es2015,stage-2",
    "build": "babel ./server -d ./dist",
    "start": "node ./dist",
    "heroku-postbuild": "cd react-ui/ && npm install && npm install    --only=dev --no-shrinkwrap && npm run build"
  },

On deploying to Heroku I get the following error

Error: Cannot find module '/app/dist'

On local npm run dev, npm run build, and npm run start work fine.

Where is it getting the /app folder? How to fix this?

Thanks Matloob



Solution 1:[1]

Try this :

"start:heroku": "node dist/YOUR-APP-NAME/server/main.js",

Solution 2:[2]

You should be able to accomplish this by using the bound action ReceiveAndInvoice on the Purchase Orders API.

The endpoint should look (something) like this:

https://api.businesscentral.dynamics.com/v2.0/{environment}/api/v1.0/companies({id})/purchaseOrders({id}})/Microsoft.NAV.receiveAndInvoice

For more information you can check out this blog post.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aihab Gmati
Solution 2