为了账号安全,请及时绑定邮箱和手机立即绑定

运行npm run build 报错,已装了webpack-cli

E:\webpack-vue>npm run build


> webpack-vue@1.0.0 build E:\webpack-vue

> webpack --config webpack.config.js


E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:244

                                throw err;

                                ^


Error: Cannot find module 'E:\webpack-vue\webpack.config.js'

    at Function.Module._resolveFilename (module.js:547:15)

    at Function.Module._load (module.js:474:25)

    at Module.require (module.js:596:17)

    at require (E:\webpack-vue\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)

    at WEBPACK_OPTIONS (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:133:13)

    at requireConfig (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:135:6)

    at E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:142:17

    at Array.forEach (<anonymous>)

    at module.exports (E:\webpack-vue\node_modules\webpack-cli\bin\convert-argv.js:140:15)

    at yargs.parse (E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:241:39)

    at Object.parse (E:\webpack-vue\node_modules\yargs\yargs.js:552:18)

    at E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:219:8

    at Object.<anonymous> (E:\webpack-vue\node_modules\webpack-cli\bin\cli.js:530:3)

    at Module._compile (module.js:652:30)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Module.require (module.js:596:17)

    at require (internal/module.js:11:18)

    at Object.<anonymous> (E:\webpack-vue\node_modules\webpack\bin\webpack.js:157:2)

    at Module._compile (module.js:652:30)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Function.Module.runMain (module.js:693:10)

    at startup (bootstrap_node.js:191:16)

    at bootstrap_node.js:612:3

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! webpack-vue@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the webpack-vue@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\issuser\AppData\Roaming\npm-cache\_logs\2018-06-08T03_23_22_529Z-debug.log


正在回答

4 回答

webpack4.x的可以看看这里

https://blog.csdn.net/u012443286/article/details/79504289

0 回复 有任何疑惑可以回复我~

请教一下,你的问题解决了吗?出现的同样的问题

0 回复 有任何疑惑可以回复我~

我和你报的一样的错,下了一个webpack-cli  然后出来这个错误,你们怎么解决的呀

0 回复 有任何疑惑可以回复我~

请选择webpack-dev-server @2版本   

提供 给你package.json

{
  "name": "vue-build",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "cross-env": "^5.1.6",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.2.0",
    "less": "^3.0.4",
    "less-loader": "^4.1.0",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "vue": "^2.5.16",
    "vue-loader": "^15.2.4",
    "vue-style-loader": "^4.1.0",
    "vue-template-compiler": "^2.5.16",
    "webpack": "^3.12.0",
    "webpack-dev-server": "^2.11.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "cross-env NODE_ENV=production webpack --config webpack.config.js",
    "dev": "cross-env NODE_ENV=developlment webpack-dev-server --config webpack.config.js"
  },
  "author": "",
  "license": "ISC"
}


0 回复 有任何疑惑可以回复我~
#1

qq_明_72 提问者

请问下老师讲的是webpack 4吗?
2018-06-08 回复 有任何疑惑可以回复我~
#2

媄玅亽甡 回复 qq_明_72 提问者

这里讲的是webpack@3这个版本。你看一下我的 package.json里面都会有相应的版本信息
2018-06-08 回复 有任何疑惑可以回复我~
#3

qq_明_72 提问者 回复 媄玅亽甡

那会不会过时呢。。。我下的全是最新版本的, 是不是要删除之前的新版本才能用老版本呢?
2018-06-08 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

运行npm run build 报错,已装了webpack-cli

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信