如何修复“没有这样的文件或目录,lstat 'scss/'"? [英] How to fix "no such file or directory, lstat 'scss/'"?

查看:113
本文介绍了如何修复“没有这样的文件或目录,lstat 'scss/'"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 youtube 上学习一个简单的教程 https://www.youtube.com/watch?v=gYzHS-n2gqU&t=900s 他正在尝试使用终端运行 npm 脚本sass"文件.
-当我执行命令 npm run sass 时向我显示一条错误消息错误:ENOENT:没有那个文件或目录,lstat 'scss/'

i'm trying to follow a simple tutorial on youtupe https://www.youtube.com/watch?v=gYzHS-n2gqU&t=900s where he is tring to run an npm scripts "sass" file using the tirminal.
-When i execut the command npm run sass shows me an error message Error: ENOENT: no such file or directory, lstat 'scss/'

-我认为文件路径或文件权限问题,应该在哪里配置以查看正确的目录.
- 这是文件夹结构
-当我用 :

-I think the problem with the path of file or permissions on the file, where should configure in way to looks in the correct director.
- here is folder structure
-When i replace the script with :

"scripts": {
    **"sass": "echo \"Error: no test specified\" "**
  },

它工作正常.,但是

"scripts": {
    "sass": "node-sass -w scss/ -o dist/css/ --recursive" 
  },

给我一​​个错误.package.json:

give me an error. package.json:

 {
  "name": "abrahem_portfolio",
  "version": "1.0.0",
  "description": "PortFolio",
  "main": "index.js",
  "scripts": {
    **"sass": "node-sass -w scss/ -o dist/css/ --recursive"**

  },
  "author": "Abrahem Gh",
  "license": "ISC",
  "dependencies": {
    "node-sass": "^4.12.0"
  }
}

-作为终端应显示的教程点:

-As the tutorial point that the terminal should show this:

abrahem_portfolio@1.0.0 sass C:\Users\Abrahim\Abrahem_portfolionode-sass -w scss/-o dist/css/--recursive

abrahem_portfolio@1.0.0 sass C:\Users\Abrahim\Abrahem_portfolio node-sass -w scss/ -o dist/css/ --recursive

-但它显示一个错误:

abrahem_portfolio@1.0.0 sass C:\Users\Abrahim\Abrahem_portfolionode-sass -w scss/-o dist/css/--recursive

abrahem_portfolio@1.0.0 sass C:\Users\Abrahim\Abrahem_portfolio node-sass -w scss/ -o dist/css/ --recursive

fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, lstat 'scss/'
    at Object.lstatSync (fs.js:845:3)
    at Object.module.exports.parseDir (C:\Users\Abrahim\Abrahem_portfolio\node_modules\sass-graph\sass-graph.js:153:10)
    at Object.watcher.reset (C:\Users\Abrahim\Abrahem_portfolio\node_modules\node-sass\lib\watcher.js:17:21)
    at watch (C:\Users\Abrahim\Abrahem_portfolio\node_modules\node-sass\bin\node-sass:260:20)
    at run (C:\Users\Abrahim\Abrahem_portfolio\node_modules\node-sass\bin\node-sass:319:5)
    at Object.<anonymous> (C:\Users\Abrahim\Abrahem_portfolio\node_modules\node-sass\bin\node-sass:405:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abrahem_portfolio@1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the abrahem_portfolio@1.0.0 sass 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\Abrahim\AppData\Roaming\npm-cache\_logs\2019-08-25T07_38_42_251Z-debug.log

项目结构如下所示:https://i.stack.imgur.com/KG082.png

推荐答案

查看文件夹结构时,您可以发现

When looking at your folder structure you can spot that the

"scripts": {
    "sass": "node-sass -w scss/ -o dist/css/ --recursive" 
  },

command 查找名为 scss 的文件夹,但在您的项目结构中,您有一个名为 sass 的文件夹因此,可以通过将 sass 文件夹重命名为 scss 来解决此错误.

command looks for a folder named scss but in your project structure you have a folder called sass This error can thus be solved by renaming the sass folder to scss.

以下解决方案可以解决问题:

The following solution would fix the problem:

"scripts": {
    "sass": "node-sass -w sass/ -o dist/css/ --recursive" 
  },

这篇关于如何修复“没有这样的文件或目录,lstat 'scss/'"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆