更改根文件的名称会破坏构建

时间:2017-08-22 20:16:16

标签: javascript node.js reactjs

我只是尝试将根文件夹名称从/app更改为/src,但是,当我执行并运行npm start时,我收到错误:

fs.js:582
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/colinsygiel/liquidtool/liquid-tool-system-ui/lts-admin/app/index.html'

我进入index.html并将相应的app更改为src,但我仍然遇到同样的错误。

我认为它与index.html中的/app仍在尝试寻找/src中的"scripts": { "analyze:clean": "rimraf stats.json", "preanalyze": "npm run analyze:clean", "analyze": "node ./internals/scripts/analyze.js", "extract-intl": "babel-node --presets latest,stage-0 -- ./internals/scripts/extract-intl.js", "npmcheckversion": "node ./internals/scripts/npmcheckversion.js", "preinstall": "npm run npmcheckversion", "postinstall": "npm run build:dll", "prebuild": "npm run build:clean", "build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress", "build:clean": "npm run test:clean && rimraf ./build", "build:dll": "node ./internals/scripts/dependencies.js", "start": "cross-env NODE_ENV=development node server", "start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server", "start:production": "npm run test && npm run build && npm run start:prod", "start:prod": "cross-env NODE_ENV=production node server", "presetup": "npm i chalk shelljs", "setup": "node ./internals/scripts/setup.js", "postsetup": "npm run build:dll", "clean": "shjs ./internals/scripts/clean.js", "clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean", "generate": "plop --plopfile internals/generators/index.js", "lint": "npm run lint:js", "lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern internals/scripts", "lint:js": "npm run lint:eslint -- . ", "lint:staged": "lint-staged", "pretest": "npm run test:clean && npm run lint", "test:clean": "rimraf ./coverage", "test": "cross-env NODE_ENV=test jest --coverage", "test:watch": "cross-env NODE_ENV=test jest --watchAll", "coveralls": "cat ./coverage/lcov.info | coveralls" }, 时有关。

如果有帮助,这是我的package.json脚本:

const express = require('express');
const logger = require('./logger');

const argv = require('minimist')(process.argv.slice(2));
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok = (isDev && process.env.ENABLE_TUNNEL) || argv.tunnel ? require('ngrok') : false;
const resolve = require('path').resolve;
const app = express();

// If you need a backend, e.g. an API, add your custom backend-specific middleware here
// app.use('/api', myApi);

// In production we need to pass these values in instead of relying on webpack
setup(app, {
  outputPath: resolve(process.cwd(), 'build'),
  publicPath: '/',
});

// get the intended host and port number, use localhost and port 3000 if not provided
const customHost = argv.host || process.env.HOST;
const host = customHost || null; // Let http.Server use its default IPv6/4 host
const prettyHost = customHost || 'localhost';

const port = argv.port || process.env.PORT || 3001;

// Start your app.
app.listen(port, host, (err) => {
  if (err) {
    return logger.error(err.message);
  }

  // Connect to ngrok in dev mode
  if (ngrok) {
    ngrok.connect(port, (innerErr, url) => {
      if (innerErr) {
        return logger.error(innerErr);
      }

      logger.appStarted(port, prettyHost, url);
    });
  } else {
    logger.appStarted(port, prettyHost);
  }
});

server.js:

routes.MapRoute(
    name: "MarkOnlineRoute",
    url: "api/{controller}",
    defaults: new { action = "MarkOnline" }
);

0 个答案:

没有答案