启动服务器时出现Angular 2错误:Config未导出对象

时间:2017-01-24 20:42:52

标签: angular webpack

我最近刚刚将Angular 2项目更新为最新版本。我正在使用webpack

我的package.json文件

C:\louis-ui\lois-ui-ng2>npm start

> loyalty-one-lois@1.0.0 start C:\louis-ui\lois-ui-ng2
> npm run server:dev


> loyalty-one-lois@1.0.0 server:dev C:\louis-ui\lois-ui-ng2
> webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/

Config did not export an object.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run
" "server:dev"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! loyalty-one-lois@1.0.0 server:dev: `webpack-dev-server --config config/webpack.dev.js --progress --profile --wa
tch --content-base src/`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the loyalty-one-lois@1.0.0 server:dev script 'webpack-dev-server --config config/webpack.dev.js --pro
gress --profile --watch --content-base src/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the loyalty-one-lois package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs loyalty-one-lois
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls loyalty-one-lois
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\louis-ui\lois-ui-ng2\npm-debug.log

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "sta
rt"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! loyalty-one-lois@1.0.0 start: `npm run server:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the loyalty-one-lois@1.0.0 start script 'npm run server:dev'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the loyalty-one-lois package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run server:dev
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs loyalty-one-lois
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls loyalty-one-lois
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\louis-ui\lois-ui-ng2\npm-debug.log

我删除了node_modules,运行npm cache clean并重新运行npm install。当我尝试使用npm start

启动服务器时
/**
 * @author: @AngularClass
 */

// Look in ./config folder for webpack.dev.js
switch (process.env.NODE_ENV) {
  case 'prod':
  case 'production':
    module.exports = require('./config/webpack.prod')({env: 'production'});
    break;
  case 'test':
  case 'testing':
    module.exports = require('./config/webpack.test')({env: 'test'});
    break;
  case 'dev':
  case 'development':
  default:

    module.exports = require('./config/webpack.dev')({env: 'development'});
}

我的webpack.config.js文件如下

img

任何提示都将不胜感激。

0 个答案:

没有答案