[英]Running npm run compile:sass returns error: npm ERR! missing script: compile:sass
The sass folders and files are in the correct place. sass 文件夹和文件在正确的位置。 What is wrong?
怎么了?
I have the package.json which I created, with this code in there.我有我创建的 package.json,其中有这段代码。
{
"name": "starter",
"version": "1.0.0",
"description": "starter file",
"main": "index.js",
"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.css -w"
},
"author": "Nez",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.12.0"
}
}
As you can see the script is called compile sass when I try to run it it keeps giving the error npm ERR: missing script: compile:sass如您所见,当我尝试运行该脚本时,该脚本被称为 compile sass,它一直给出错误 npm ERR: missing script: compile:sass
I have the sass compiler installed already as a dev dependency我已经安装了 sass 编译器作为开发依赖项
I had this happen as well. 我也有这种情况。 The only way I could fix it was to move my files out of my dropbox folder on an external hard drive and move them to my main computers' hard drive.
我可以解决的唯一方法是将文件从外部硬盘驱动器上的保管箱文件夹中移出,然后将其移至主计算机的硬盘驱动器中。 I think it has something to do with Dropbox, but I'm not sure.
我认为这与Dropbox有关,但我不确定。
One of your sass files has a syntax error您的 sass 文件之一有语法错误
eg.例如。 file 1 has
文件 1 有
the %pink value is undefined you should check your files if %pink * is implemented %pink值未定义,如果%pink * 被实现,你应该检查你的文件
我遇到了同样的问题并尝试了所有方法,直到我简单地将项目文件保存在我的代码编辑器中,然后突然它就起作用了。
Add this to your code all you need to do is add npx
before your node
将此添加到您的代码中,您需要做的就是在
node
之前添加npx
Ie npx node...
即
npx node...
Then go to your terminal to that directory and run this command npm run compile:sass
然后转到您的终端到该目录并运行此命令
npm run compile:sass
Hope this works...because it worked for me will work for you too希望这有效……因为它对我有用,对你也有用
我想你应该检查你的文件路径
After 3 years. 3年后。 for me it's solved by rewriting the package:json "scripts" line :
对我来说,它是通过重写 package:json “脚本”行解决的:
"compile:sass": "node-sass sass/main.scss css/style.css -w"
"scripts": {
"sass": "sass sass/main.scss css/style.css",
"test": "echo \"Error: no test specified\" && exit 1"
},
npm run sass
npm run sass
Note: I have used main.scss as source file name注意:我使用main.scss作为源文件名
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.