使用npm脚本运行webpack

时间:2016-05-03 15:46:34

标签: node.js npm webpack npm-install

我尝试使用npm脚本但有一些错误 npm运行服务器

> emergency-webclient@1.0.0 server C:\Work\emergency-webclient\src\src\main\webapp\public
> webpack-dev-server

module.js:440
    throw err;
    ^

Error: Cannot find module 'C:\Work\emergency-webclient\src\src\main\webapp\public\*'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:159:18)
    at node.js:444:3

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Illorian\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "server"

也许存在更简单的启动脚本的方式? 在它之前我使用了gulp

Webpack和Webpack-dev-server作为全局安装。

$ node -v
v6.0.0

$ npm -v
3.8.7

的package.json

{
    "dependencies"   : {
        "angular2"        : "latest",
        "rxjs"            : "latest",
        "core-js"         : "^2.3.0",
        "zone.js"         : "~0.6.12",
        "es6-shim"        : "^0.35.0",
        "reflect-metadata": "^0.1.3"
    },
    "devDependencies": {
        //some deps
        "webpack"                    : "^1.13.0",
        "webpack-dev-server"         : "^1.14.1"
    }
}

1 个答案:

答案 0 :(得分:3)

重新安装Windows有助于解决此问题