问答详情
源自:3-2 配置vue的jsx写法以及postcss

postcss配置正常安装就报错

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


提问者:shelleyYuki 2018-11-19 21:46

个回答

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

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

  • 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