package.json
{ "name": "vue-todo", "version": "1.0.0", "description": "vue-todoList", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "cross-env NODE_ENV=production webpack --mode production webpack.config.js", "dev": "cross-env NODE_ENV=development webpack-dev-server webpack --mode development webpack.config.js" }, "author": "bzy", "license": "ISC", "dependencies": { "stylus": "^0.54.5", "vue": "^2.5.17" }, "devDependencies": { "cross-env": "^5.2.0", "css-loader": "^1.0.0", "file-loader": "^2.0.0", "html-webpack-plugin": "^3.2.0", "style-loader": "^0.23.1", "stylus-loader": "^3.0.2", "url-loader": "^1.1.2", "vue-loader": "^15.4.2", "vue-template-compiler": "^2.5.17", "webpack": "^4.20.2", "webpack-cli": "^3.1.2" } }
报了一长串错误
ERROR in ./node_modules/_consolidate@0.15.1@consolidate/lib/consolidate.js
Module not found: Error: Can't resolve 'templayed' in 'E:\WebstormProjects\vue-todo\node_modules\_consolidate@0.15.1@consolidate\lib'
@ ./node_modules/_consolidate@0.15.1@consolidate/lib/consolidate.js 845:61-81
@ ./node_modules/_consolidate@0.15.1@consolidate/index.js
@ ./node_modules/_@vue_component-compiler-utils@2.2.0@@vue/component-compiler-utils/dist/compileTemplate.js
@ ./node_modules/_@vue_component-compiler-utils@2.2.0@@vue/component-compiler-utils/dist/index.js
@ ./node_modules/_vue-loader@15.4.2@vue-loader/lib/index.js
@ ./node_modules/_vue-loader@15.4.2@vue-loader/lib/loaders/pitcher.js
@ ./node_modules/_vue-loader@15.4.2@vue-loader/lib/plugin.js
@ ./webpack.config.js
@ multi (webpack)-dev-server/client?http://127.0.0.1:8080 webpack ./webpack.config.js
Module not found: Error: Can't resolve 'fs'
。。。
Module not found: Error: Can't resolve 'toffee'
。。。
同样的问题 , 楼主解决了吗 ? 呜呜
"dev": "cross-env NODE_ENV=development webpack-dev-server webpack --mode development webpack.config.js"
看这行代码,你同时用webpack-dev-server和webpack打包?
这种报错是安装的wbapck-dev-server是3以上版本搞的,卸掉后
npm install webpack-dev-server@2.9.1 -D 就可以了
升级webpack4之后踩的坑
问题 出在了
"build": "cross-env NODE_ENV=production webpack --mode production webpack.config.js", "dev": "cross-env NODE_ENV=development webpack-dev-server webpack --mode development webpack.config.js"
其实应该是
"build": "cross-env NODE_ENV=production webpack --mode production --config webpack.config.js", "dev": "cross-env NODE_ENV=development webpack-dev-server --mode development --config webpack.config.js"
谁能帮我源码看一下
缺少必要模块。建议删除整个.node_modules 后,再 npm install vue vue-loader。如果 npm 出现各种错误,可以使用 cnpm,将 npm 镜像设置为淘宝镜像可以加快速度和减少模块下载失败率