随笔-生活工作点滴

拷贝的vue项目在本地运行

2019-07-05  本文已影响0人  双耳云

1.安装chromedriver

npm install --global chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

2.安装插件

npm install

3.问题一:

Module build failed: Error: No ESLint configuration found.
    at Config.getLocalConfigHierarchy (F:\WorkSpace\web\node_modules\eslint\lib\config.js:255:39)
    at Config.getConfigHierarchy (F:\WorkSpace\web\node_modules\eslint\lib\config.js:179:43)
    at Config.getConfigVector (F:\WorkSpace\web\node_modules\eslint\lib\config.js:286:21)
    at Config.getConfig (F:\WorkSpace\web\node_modules\eslint\lib\config.js:329:29)
    at processText (F:\WorkSpace\web\node_modules\eslint\lib\cli-engine.js:163:33)
    at CLIEngine.executeOnText (F:\WorkSpace\web\node_modules\eslint\lib\cli-engine.js:620:17)
    at lint (F:\WorkSpace\web\node_modules\eslint-loader\index.js:218:17)
    at Object.module.exports (F:\WorkSpace\web\node_modules\eslint-loader\index.js:213:21)

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

解决方法:

npm init -y
npm install eslint --save-dev
./node_modules/.bin/eslint --init 初始化配置文件

4.问题二:

Vue 项目启动抛出 Syntax Error/ Unexpected token
Syntax Error: Unexpected token (133:4)

  131 |   },
  132 |   computed: {
> 133 |     ...mapGetters([
      |     ^
  134 |       'btnAction'
  135 |     ])
  136 |   },

 @ ./src/views/userMng/components/tableModule.vue 9:0-117 10:0-130
 @ ./src/views ^\.\/.*\.vue$
 @ ./src/router/_import_development.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8011 webpack/hot/dev-server babel-polyfill ./src/main.js

解决方法:需要在项目根目录创建一个 .balbelrc 文件进行

{
  "presets": [
    ["env", {
      "modules": false
    }],
    "stage-2"
  ],
  "plugins": ["transform-runtime", "transform-vue-jsx"]
}

5.问题三

 error  in ./node_modules/element-ui/lib/theme-chalk/index.css

Module build failed: Error: No PostCSS Config found in: F:\WorkSpace\web\node_modules\element-ui\lib\theme-chalk
    at config.load.then (F:\WorkSpace\web\node_modules\postcss-load-config\src\index.js:55:15)
    at <anonymous>

 @ ./node_modules/element-ui/lib/theme-chalk/index.css 4:14-124 13:3-17:5 14:22-132
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8011 webpack/hot/dev-server babel-polyfill ./src/main.js

解决方法:重新创建 node-sass

npm rebuild node-sass

6.问题四

 error  in ./src/assets/css/global.scss

Module build failed: Error: No PostCSS Config found in: F:\WorkSpace\web\src\assets\css
    at config.load.then (F:\WorkSpace\web\node_modules\postcss-load-config\src\index.js:55:15)
    at <anonymous>

 @ ./src/assets/css/global.scss 4:14-213 13:3-17:5 14:22-221
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8011 webpack/hot/dev-server babel-polyfill ./src/main.js

解决方法:需要在根文件里面新建一个文件postcss.config.js ,在里面添加以下代码:

module.exports = {
    plugins: {
        'autoprefixer': {browsers: 'last 5 version'}
    }
}

7.问题五

Errors:
  1  http://eslint.org/docs/rules/null

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

解决方法:因为设置了eslint,如果不想有规范的js代码,注释...(config.dev.useEslint ? [createLintingRule()] : []),

 module: {
    rules: [
     // ...(config.dev.useEslint ? [createLintingRule()] : []),
    ......
    ]
  },

问题解决!!!

上一篇下一篇

猜你喜欢

热点阅读