环境:

win7

node v8.11.1

npm v5.6.0

背景:

最近vue项目使用sass,所以需要sass-loader,sass-loader依赖node-sass,还需安装node-sass,但是安装node-sass又太慢了。

解决:

切换国内镜像

$ npm install -g mirror-config-china --registry=http://registry.npm.taobao.org

安装sass-loader、node-sass(-D 是 --save-dev 的简写)

$ npm install sass-loader node-sass -D

切换为国内镜像后,安装只需少量时间

然后启动项目

$ npm run dev

总是报错,Modele build failed: TypeError: this.getResolve is not a function at Object.loader...

安装的sass-loader的版本为最新8.0.0,查看网上资料说是版本过高导致编译错误。

我把项目package.json文件中sass-loader版本改为7.3.1

执行命令,重新安装项目依赖

$ npm install

然后,启动项目

$ npm run dev

项目启动成功,编译报错问题解决

解决npm安装node-sass太慢及编译错误问题的更多相关文章

  1. 解决:安装SQL Server 2008 Native Client遇到错误(在Navicat premium新建sqlserver连接时 需要):An error occurred during ...HRESULT: 0x80070422(注意尾部的错误号)

    解决:安装SQL Server 2008 Native Client遇到错误(在Navicat premium新建sqlserver连接时 需要):An error occurred during . ...

  2. 解决ubuntu安装软件has install-snap change in progress错误

    解决ubuntu安装软件has install-snap change in progress错误 2018年05月06日 13:45:39 山间明月江上清风_ 阅读数:14316 标签: ubunt ...

  3. 怎么解决ERROR in Node Sass does not yet support your current environmen问题?

    好久没有重新安装node.js,昨天和小伙伴们一起安装,由于自己是在网上自行下载的node,安装地比较顺利,但另外两个小伙伴用的共享文件夹里自带的node,却是屡次碰到问题,快被逼疯,在运行Vue时总 ...

  4. vue 项目 使用sass,node-sass 安装方法及cnpm下如何安装node sass

    内容为转载,方便用时查阅,原文地址: https://www.cnblogs.com/crazycode2/p/6535105.html 1,使用save会在package.json中自动添加. 1 ...

  5. Ubuntu环境下使用npm安装node模块时报错的处理方法

    错误信息: npm ERR : node: not found : npm ERR! not ok code 0 解决方案: sudo apt-get install nodejs-legacy 也可 ...

  6. 解决npm安装模块时 npm err! registry error parsing json

    最近还真是点背,从yeoman生成一个react项目或是github上克隆一个项目,在npm install的时候, 一直报npm err! registry error parsing json(就 ...

  7. 转载:解决npm安装时出现run `npm audit fix` to fix them, or `npm audit` for details

    转载自:https://blog.csdn.net/qq_39165556/article/details/89333028 1.第一种解决办法 npm audit fix npm audit fix ...

  8. npm安装node包时怎么显示安装进度

    npm config set loglevel=http 打开这个你会看到所有的 HTTP 请求,除此之外如果还有 \ 长时间打转,那就是外部模块的编译过程,一个字:等. 具体地址可参考https:/ ...

  9. 解决npm安装时出现run `npm audit fix` to fix them, or `npm audit` for details 的问题

    npm audit fix npm audit fix --force npm audit 按照顺序一一运行亲测完全可用如果还是不行的话,可以把node_modules和package-lock.js ...

随机推荐

  1. 3.创建一个pod应用

    创建一个应用:k8s增删查改: pod创建:kubectl run nginx-deploy --image=nginx:1.14-alpine --port=80 --replicas=1 [roo ...

  2. Two-stream双流总结

    1.2014.Two-stream convolutional networks for action recognition in videos 两个流:空间流做single frame,时间流做m ...

  3. 【Struts中private static final long serialVersionUID的作用】

     private static final long serialVersionUID = -1672970955045193907L;   SerialVersionUID,后面简称SUID 其实序 ...

  4. MySQL安装Write configuration file 提示:configuration file template my.ini Error code-1

    在安装MySQL的时候, 在最后安装时,最后一步出现Write configuration file没成功勾选,并提示:configuration file template D:\mysql\my- ...

  5. python tarfile模块

    TarFile类对于就是tar压缩包实例. 其由member块组成, member块则包括header块和data块. 每个member以TarInfo对象形式描述. 所以TarFile就是TarIn ...

  6. MySQL_数据查询

    目录 1.查看数据的两种方法 2.查看数据并进行筛选(where) 3.不查看重复记录(distinct),空值,非空值 5.查看指定行(limit) 6.模式匹配(like) regexp 6.范围 ...

  7. Laravel注册登陆认证API

    注册接口 路由api.php:Route::post('register', 'Auth\RegisterController@register'); 控制器 http//controllers/au ...

  8. delphi 相关好的资料网站

    1.Delphi编程技巧大全   http://www.delphitop.com/  (实例讲解所有组件) 2.Delphi学习大师  Delphi基础教程 视频教程  http://www.xue ...

  9. Linux系列:之软件安装

    1.安装软件 不同的Linux版本可能使用不同的软件管理机制. RPM:使用这类命令进行安装的Linux版本有CentOS. DPKG:使用这类命令进行安装的Linux版本有Debian.Ubuntu ...

  10. Qt5笔记(一)

      1.  只要指定父对象,直接或间接继承于QObect,那么子对象如果是动态分配空间,不需要手动释放内存,系统会自动释放.( Qt的内存回收机制) 2.  想要查看某个函数,可以F1进入帮助文档,连 ...