前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >vue+sass 下sass不能运行问题

vue+sass 下sass不能运行问题

作者头像
用户1749219
发布2018-05-16 11:29:40
1.1K0
发布2018-05-16 11:29:40
举报
文章被收录于专栏:落花落雨不落叶

好久没写博文了,今天抽空写一写,最近在用vue.js build 项目,今早想使用sass来编译css,可是安装好依赖包之后仍然显示一下错误:

代码语言:javascript
复制
ERROR in ENOENT: no such file or directory, scandir '/Users/baidu/Documents/mydata/hfutoj/node_modules/.npminstall/node-sass/3.8.0/node-sass/vendor'
 @ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js!./~/.npminstall/sass-loader/4.0.0/sass-loader!./~/vue-loader/lib/selector.js?type=style&index=0!./src/components/footer.vue 4:14-273 13:2-17:4 14:20-279

  我vue component 里面是这样用的:

代码语言:javascript
复制
<style lang="scss">
.footer {
  margin-top: 3em;
  padding-top: 2em;
  border-top: 1px solid #ccc;
  text-align: center;
  font-size: 1em;
  clear: both;
  height: 4em;}
</style>

 我心想不应该啊,我依赖包都安装了,需要的依赖包是:node-sass ,sass-loader,vue-style-loader,css-loader,分析了下,觉得是node-sass没安装好,所以我就卸载了node-sass,然后又重新安装(注意cnpm是需要使用npm安装的,这个好像是淘宝的镜像,比较快):

代码语言:javascript
复制
npm remove node-sass
cnpm install node-sass

  package.json里是这样写的:

代码语言:javascript
复制
{
  "name": "hfutoj",
  "version": "1.0.0",
  "description": "oj for hfut",
  "author": "hfuter",
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "build": "node build/build.js",
    "test": ""
  },
  "dependencies": {
    "vue": "^1.0.21",
    "babel-runtime": "^6.0.0",
    "semantic-ui": "*"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-plugin-transform-runtime": "^6.0.0",
    "babel-preset-es2015": "^6.0.0",
    "babel-preset-stage-2": "^6.0.0",
    "babel-register": "^6.0.0",
    "connect-history-api-fallback": "^1.1.0",
    "css-loader": "^0.23.0",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.13.3",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.4",
    "function-bind": "^1.0.2",
    "html-webpack-plugin": "^2.8.1",
    "http-proxy-middleware": "^0.12.0",
    "json-loader": "^0.5.4",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "node-sass": "^3.7.0",
    "ora": "^0.2.0",
    "sass-loader": "^4.0.0",
    "shelljs": "^0.6.0",
    "url-loader": "^0.5.7",
    "vue-hot-reload-api": "^1.2.0",
    "vue-html-loader": "^1.0.0",
    "vue-loader": "^8.3.0",
    "vue-style-loader": "^1.0.0",
    "webpack": "^1.12.2",
    "webpack-dev-middleware": "^1.4.0",
    "webpack-hot-middleware": "^2.6.0",
    "webpack-merge": "^0.8.3"
  }
}

  但是,仍然报错,为毛?我发现重装之后错误并没有变,仍然是.npminstall 下面的文件没被找到,所以.npminstall(这是个隐藏文件)下的文件并没有被卸载,所以我决定把整个node_modules删除了再重装(cnpm install),之后就好了,不过我把ndoe-sass的版本号由3.8.0换成了3.7.0

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-08-28 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档