[英]Error when trying to run node-sass via npm
I am trying to run node-sass via npm.我正在尝试通过 npm 运行 node-sass。
Here is my package.json:这是我的 package.json:
{ "name": "my-project", "version": "1.0.0", "description": "Website", "main": "index.js", "scripts": { "sass": "node-sass -w scss/ -o dist/css/ --recursive" }, "author": "Me", "license": "ISC", "dependencies": {} }
It installs correctly, but when I try and run the command "npm run sass", I receive the error below:它安装正确,但是当我尝试运行命令“npm run sass”时,我收到以下错误:
"An output directory must be specified when compiling a directory" “编译目录时必须指定输出目录”
My folder structure: package.json package-lock.json scss (folder) dist (folder) > css (folder) node_modules (folder)我的文件夹结构:package.json package-lock.json scss(文件夹)dist(文件夹)> css(文件夹) node_modules(文件夹)
This script used to work fine some time ago on other projects, but now is not.这个脚本前段时间在其他项目上运行良好,但现在不行了。 What am I doing wrong?
我究竟做错了什么?
I was able to fix this issue.我能够解决这个问题。 I changed the script to
我将脚本更改为
"sass": "node-sass -w scss/ -o dist/css"
and it worked.它奏效了。 I re-added --recursive and all worked as intended (same script as in original question).
我重新添加了 --recursive 并且一切都按预期工作(与原始问题中的脚本相同)。 I'm not sure where I went wrong exactly, but glad it's fixed.
我不确定我到底哪里出错了,但很高兴它被修复了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.