postcss配置正常安装就报错

来源:3-2 配置vue的jsx写法以及postcss

shelleyYuki

2018-11-19 21:46

cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js


module.js:487

    throw err;

    ^


Error: Cannot find module 'webpack/bin/config-yargs'

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

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

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

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

    at Object.<anonymous> (E:\webpack--study\webpack-personal\node_modules\webpack-dev-server\bin\webpack-dev-server.js:56:1)

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

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

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

    at tryModuleLoad (module.js:466:12)

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

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! webpack-personal@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the webpack-personal@1.0.0 dev 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\Administrator\AppData\Roaming\npm-cache\_logs\2018-11-19T13_44_54_130Z-debug.log


写回答 关注

3回答

  • scj_wcl
    2018-11-21 21:38:34

    还要安装一下postcss-import  (npm install postc-import --save-dev)

    scj_wc... 回复shelle...

    那..我也不清楚了,我用的是最新版的,

    2018-11-23 22:51:43

    共 2 条回复 >

  • scj_wcl
    2018-11-21 21:37:25

    {
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader?importLoader=1',
                    {
                        loader: 'postcss-loader',
                        options: {
                            plugins: [
                                require('postcss-import') (),
                                require('autoprefixer')({
                                    browers: ['last 5 versions']
                                })
                            ]
                        }
                    }
                ]
            }
        ),

    应该是版本的问题,你试试这样可以不,这个是对css文件的,我这边可以运行

  • 梦演绎奢华
    2018-11-20 21:36:06

    npm install cross-env
    npm install  webpack-dev-server

    shelle...

    你这我也安装了,测试无效啊

    2018-11-21 21:55:56

    共 1 条回复 >

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题