问题
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\" "**
},
it work fine. ,but
"scripts": {
"sass": "node-sass -w scss/ -o dist/css/ --recursive"
},
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_portfolio node-sass -w scss/ -o dist/css/ --recursive
-but it shows an error:
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
The project structure looks like the following: https://i.stack.imgur.com/KG082.png
回答1:
When looking at your folder structure you can spot that the
"scripts": {
"sass": "node-sass -w scss/ -o dist/css/ --recursive"
},
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"
},
来源:https://stackoverflow.com/questions/57644420/how-to-fix-no-such-file-or-directory-lstat-scss