vue项目报错 | 坑集合

4 篇文章 0 订阅

错误1

code ELIFECYCLE
npm ERR! errno 1
chromedriver@2.46.0 install:node install.js

遇到这种问题,进入项目运行(缺啥装啥)

npm install chromedriver@2.35.0 --ignore-scripts

–ignore-script :让npm避免执行package.json文件中的scripts脚本,只进行打包
报错
错误2

npm WRAM deprecated

官网的API文档中查阅为版本的问题This version has been deprecated此版本已被弃用。不过一般来说警告对项目的创建不会带来太大的影响,只要可以npm run dev可成功运行可以根据个人选择不做处理!
报错
错误3

./node_modules/css-loader
Failed to compile.

./node_modules/css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-7ba5bd90”,“scoped”:true,“hasInlineConfig”:false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue
Module build failed: CssSyntaxError: postcss-import: D:\laragon\www\vue\music\src\common\stylus\variable.styl:1:1: Unknown word
at Input.error (D:\laragon\www\vue\music\node_modules\postcss\lib\input.js:119:22)
at Parser.unknownWord (D:\laragon\www\vue\music\node_modules\postcss\lib\parser.js:506:26)
at Parser.other (D:\laragon\www\vue\music\node_modules\postcss\lib\parser.js:171:18)
at Parser.parse (D:\laragon\www\vue\music\node_modules\postcss\lib\parser.js:84:26)
at parse (D:\laragon\www\vue\music\node_modules\postcss\lib\parse.js:24:16)
at new LazyResult (D:\laragon\www\vue\music\node_modules\postcss\lib\lazy-result.js:70:24)
at Processor.process (D:\laragon\www\vue\music\node_modules\postcss\lib\processor.js:117:12)
at runPostcss (D:\laragon\www\vue\music\node_modules\postcss-import\lib\process-content.js:46:6)
at processContent (D:\laragon\www\vue\music\node_modules\postcss-import\lib\process-content.js:40:10)
at Promise.resolve.then.content (D:\laragon\www\vue\music\node_modules\postcss-import\index.js:244:12)
@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-7ba5bd90”,“scoped”:true,“hasInlineConfig”:false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-295 13:3-17:5 14:22-303
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
报错
一直报./node_modules/css-loader的错误:
(1)首先要搞清楚使用的是什么预处理器,css预处理器包括( less | sass |stylus),然后再下载对应的预处理器依赖。
如果是 less 的,执行 npm install less less-loader --save-dev 安装依赖
如果是 sass 的,执行 npm install sass sass-loader --save-dev 安装依赖
如果是 stylus 的,执行 npm install stylus stylus-loader --save-dev 安装依赖
(2)在(1)的基础上
如果是在.vue文件中引入,对应引入如下:

<style scoped lang="less " rel="stylesheet/styles"></style>
<style scoped lang="sass " rel="stylesheet/styles"></style>
<style scoped lang="stylus" rel="stylesheet/styles"></style>

如果是全局文件main,js,对应引入如下:

import 'path/index.less'
import 'path/index.sass'
import 'path/index.styl'

过程中可能还会报除上面以外的各种错,例如
编译出错
报错
把你的文件当成未引入的依赖报错
当成不存在的文件
报错
错误4
拼写错误 是babel-runtime 而不是bable-runtime
报错
错误5
webpack.base.config.js文件里,所以在alias里配置了在common目录的别名common,引用时报错
报错
报错
style引用时要加上~
报错

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值