Express js не загружать node_modules при развертывании сейчас. sh - PullRequest
1 голос
/ 17 марта 2020

я создаю простое приложение webrt c с express и запускаю его работу на локальном компьютере с npm start, но при развертывании до настоящего момента. sh мое приложение не может загрузить любой скрипт из node_modules

Мой server.js / index. js

const express = require('express');

const app = express();
const port = 8000;

// Set public folder as root
app.use(express.static(__dirname +'/public'));

// Provide access to node_modules folder from the client-side
app.use('/scripts', express.static(`${__dirname}/node_modules`));

// Redirect all traffic to index.html
app.route('/*').get((req, res) => res.sendFile(`${__dirname}/public/index.html`));

app.listen(port, () => {
  console.info('listening on %d', port);
});

. json

 {
  "name": "webrtc",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "@andyet/simplewebrtc": "^1.16.0",
    "express": "^4.17.1",
    "handlebars": "^4.7.3",
    "jquery": "^3.4.1",
    "semantic-ui-css": "^2.4.1",
    "simplewebrtc": "^3.0.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "keywords": [],
  "author": "good",
  "license": "ISC"
}

сейчас. json

{
    "version": 2,
    "builds": [{ "src": "index.js", "use": "@now/node-server" }]
}
...