1

这是我在 package.json 中的脚本

    "scripts": {
    "start": "npm-run-all --parallel development",
    "development": "babel-node node_modules/.bin/webpack-dev-server --inline --progress --colors --config ./buildScripts/webpack.dev.js"
}

这是我的 webpack.dev.js

 import path from 'path';
 import webpack from 'webpack';
 import chalk from 'chalk';
 import HtmlWebpackPlugin from 'html-webpack-plugin';
 import ExtractTextPlugin from 'extract-text-webpack-plugin';
 let argv = require('yargs').argv;
 let DEV_SERVER_PORT = 3001;
 if (typeof argv.portNumber === 'number') {
     DEV_SERVER_PORT = argv.portNumber;
 }
 console.log(chalk.blue(`Starting server of ${DEV_SERVER_PORT}.`));
 const nodeModulesDir = path.resolve(__dirname, 'node_modules');
 export default {
     debug: true,
     devtool: 'eval',
     devServer: {
         contentBase: './src',
         compress: true,
         port: DEV_SERVER_PORT,
         stats: 'minimal',
         historyApiFallback: {
             index: '/'
         }
     },
     noInfo: false,
     entry: {
         vendor: path.resolve(__dirname, './../src/app/vendor'),
         webstandards: path.resolve(__dirname, './../src/web-standards/'),
         main: [path.resolve(__dirname, './../src/app/main')]
     },
     target: 'web',
     output: {
         pathinfo: true,
         path: path.resolve(__dirname, './../src'),
         publicPath: '/',
         filename: '[name].js'
     },
     plugins: [
         // Create HTML file that includes reference to bundled JS.
         new HtmlWebpackPlugin({
             template: '!!pug!src/index.pug',
             favicon: 'src/favicon.ico',
             inject: true,
             devServer: 'http://localhost:' + DEV_SERVER_PORT,
             baseHref: '/',
         }),
         new ExtractTextPlugin("[name].css", {
             allChunks: false
         }),
         new webpack.optimize.OccurrenceOrderPlugin(),
         new webpack.HotModuleReplacementPlugin(),
         new webpack.NoErrorsPlugin()
     ],
     module: {
         loaders: [{
             test: /\.js?$/,
             exclude: [nodeModulesDir],
             loader: 'ng-annotate!babel?compact=false'
         }, {
             test: /\.css$/,
             exclude: [nodeModulesDir],
             loader: ExtractTextPlugin.extract("style-loader", "css"),
         }, {
             test: /\.scss$/,
             loader: ExtractTextPlugin.extract("style-loader", "css!sass"),
             exclude: [nodeModulesDir]
         }, {
             test: /\.html$/,
             loader: 'html',
             exclude: [nodeModulesDir]
         }, {
             // Load images
             test: /\.(png|jpg|jpeg|gif)$/,
             loader: 'url?limit=5000&name=images/[name].[ext]'
         }, {
             test: /\.((woff2?|svg)(\?v=[0-9]\.[0-9]\.[0-9]))|(woff2?        |svg)$/,
             loader: "url?limit=10000"
         }, {
             test: /\.((ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9]))|(ttf|eot)$/,
             loader: "file"
         }]
     }
 }

当我使用 npm start 运行项目时

我收到错误这是我的控制台 window44 的摘录

E:\mobile-standards>npm start

webstandards@1.0.7 start E:\mobile-standards npm-run-all --并行开发

webstandards@1.0.7 开发 E:\mobile-standards babel-node node_modules/.bin/webpack-dev-server --inline --progress --colors --config ./buildScripts/webpack.dev.js

E:\mobile-standards\node_modules.bin\webpack-dev-server:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^ ^^^

SyntaxError: missing ) 在 Module._compile (module.js:542:28) 在 Module._extensions 的 Object.runInThisContext (vm.js:97:10) 的 createScript (vm.js:56:10) 的参数列表之后。 js (module.js:579:10) 在 Object.require.extensions.(匿名函数) [as .js] (E:\mobile-standa rds\node_modules\babel-register\lib\node.js:152:7 ) 在 Module.load (module.js:487:32) 在 tryModuleLoad (module.js:446:12) 在 Function.Module._load (module.js:438:3) 在 Function.Module.runMain (module.js :604:10) 在 E:\mobile-standards\node_modules\babel-cli\lib_babel-node.js:159:24

现在,我在 Windows 系统上指定节点模块路径时已经完成了有关此错误的研究。

但还没有运气。

有人可以将我推向正确的方向吗?

4

0 回答 0