可能无法在控制指令或其他mixin中定义函数

时间:2022-08-24 16:24:10

In my nodeJS project suddenly it give error.I do not any upgrade or changes. When I write NPM start in command line it give that error

在我的nodeJS项目中突然出现错误。我没有任何升级或更改。当我在命令行中编写NPM启动时,它会给出错误

 ERROR in ./~/css-loader?sourceMap!./~/postcss-loader!./~/sass-loader?
sourceMap&outputStyle=expanded&includePaths[]=c:/TFS/rc1/app/scss&includePaths[]

=c:/TFS/rc1/~/compass-mixins/lib&sourceMap&sourceMapContents=true!./app/scss/_toolkit.scss
    Module build failed:
    undefined
     ^
          Functions may not be defined within control directives or other mixins.
          in c:\TFS\rc1\node_modules\compass-mixins\lib\compass\functions\_lists.scss (line 81, column 3)
     @ ./app/scss/_toolkit.scss 4:14-337

I reinstall compass-mixins package but it still give same error.Then I looked _lists.scss that file in 81 line there is a code .I deleted that bu it give same error.What should I do?

我重新安装了compass-mixins软件包,但它仍然给出了同样的错误。然后我在81行看了_lists.scss那个文件有一个代码。我删除了它给它同样的错误。我该怎么办?

@if not(function-exists(compact)) {
  @function compact($vars...) {
    $list: ();
    @each $var in $vars {
        @if $var {
            $list: append($list, $var, comma);
        }
    }
    @return $list;
  }
}

5 个解决方案

#1


6  

I also face the similar problem. And my project is using gulp-sass and compass-mixins. As heart.cooks.mind points out that, gulp-sass is depending on node-sass. And node-sass upgrade one of its dependence libsass to version libsass 3.3.3 Delorean since node-sass 3.5.1.

我也面临类似的问题。我的项目是使用gulp-sass和compass-mixins。正如heart.cooks.mind所指出的那样,gulp-sass依赖于node-sass。并且node-sass将其依赖libsass之一升级到版本libsass 3.3.3 Delorean,因为node-sass 3.5.1。

However, one of libsass 3.3.3 Delorean changes is related to this problem:
'Disallow functions to be defined in control directives or mixins (@mgreter, #1550)'

但是,libsass 3.3.3 Delorean更改之一与此问题有关:'禁止在控制指令或mixins(@ mgreter,#1550)中定义函数'

Obviously, _lists.scss in compass-mixins break this rule. Seems someone raise an issue to compass-mixins and they have idea on fixing it.

显然,指南针混合中的_lists.scss打破了这个规则。似乎有人向罗盘混音师提出了一个问题,他们有解决问题的想法。

Before compass-mixins release the issue fixed version, my temporary workaround is to delete node_modules/node-sass manually and npm install node-sass@3.4.2

在compass-mixins发布问题修复版之前,我的临时解决方法是手动删除node_modules / node-sass并且npm install node-sass@3.4.2

#2


2  

I had the same issue,please refer to node sass release 3.5.3 is breaking build and force lock gulp-sass to use the specific node sass library using shrinkwrap and avoid using the buggy version of node sass

我有同样的问题,请参考节点sass版本3.5.3正在打破构建和强制锁定gulp-sass使用特定节点sass库使用shrinkwrap并避免使用节点sass版本的sass

#3


1  

I am using Gulp. Version 2.3.0 of gulp-sass breaks it. Go back to Version 2.2.0 and you are all fixed.

我正在使用Gulp。版本2.3.0的gulp-sass打破了它。回到2.2.0版本,你们都修复了。

Edit:

编辑:

The real culprit is the node module inside the "gulp-sass" node module known as "node-sass". You can see inside "gulp-sass"'s package.json file that it simply pulling version greater than ^3.5.3.

真正的罪魁祸首是“gulp-sass”节点模块中的节点模块,称为“node-sass”。您可以在“gulp-sass”的package.json文件中看到它只是拉大于^ 3.5.3的版本。

Even if you go back and reinstall "gulp-sass" to 2.2.0, as I suggested earlier, the package.json file in there will still pull "node-sass" greater than ^3.5.3.

即使你回去并重新安装“gulp-sass”到2.2.0,正如我之前建议的那样,那里的package.json文件仍会将“node-sass”拉大于^ 3.5.3。

If I use the older version of "node-sass" 3.4.2 that error goes away. I don't know how to fix that in an automated way. In a pinch I was able to fix the problem by copying that folder (that is using 3.4.2) from a different project that works. Now it compiles.

如果我使用旧版本的“node-sass”3.4.2,那么错误就会消失。我不知道如何以自动方式解决这个问题。在紧要关头,我能够通过从一个有效的不同项目中复制该文件夹(即使用3.4.2)来解决问题。现在它编译。

Can someone smarter than me figure out a better way to accomplish this result?

能比我聪明的人找到更好的方法来实现这个结果吗?

#4


1  

What I (temporarily) did, was to install globally the node-sass v3.4.2, and then replace the gulp-sass version of node-sass (it is located within gulp-sass/node_modules) with this older one.

我(暂时)做的是全局安装node-sass v3.4.2,然后用这个较旧的版本替换node-sass的gulp-sass版本(它位于gulp-sass / node_modules中)。

sudo npm install -g node-sass@3.4.2;
sudo cp -r /usr/lib/node_modules/node-sass/ /usr/lib/node_modules/gulp-sass/node_modules/;

#5


1  

Btw, there is a PR waiting to be merged for this. But if you want to use this today then there's a fork of the merge too.
If you want to use latter then just put compass-mixins: tjenkinson/compass-mixins in your package.json and all will be good.

顺便说一下,有一个公关等待合并。但是如果你今天想要使用它,那么合并的分叉也是如此。如果你想使用后者,那么只需将compass-mixins:tjenkinson / compass-mixins放入你的package.json中,一切都会好的。

Update:- There's also an npm package for the latter mentioned in the PR now

更新: - 现在PR还提到了后者的npm包

Update 2:- This should no longer be a problem with v0.12.8 now

更新2: - 现在不再是v0.12.8的问题了

#1


6  

I also face the similar problem. And my project is using gulp-sass and compass-mixins. As heart.cooks.mind points out that, gulp-sass is depending on node-sass. And node-sass upgrade one of its dependence libsass to version libsass 3.3.3 Delorean since node-sass 3.5.1.

我也面临类似的问题。我的项目是使用gulp-sass和compass-mixins。正如heart.cooks.mind所指出的那样,gulp-sass依赖于node-sass。并且node-sass将其依赖libsass之一升级到版本libsass 3.3.3 Delorean,因为node-sass 3.5.1。

However, one of libsass 3.3.3 Delorean changes is related to this problem:
'Disallow functions to be defined in control directives or mixins (@mgreter, #1550)'

但是,libsass 3.3.3 Delorean更改之一与此问题有关:'禁止在控制指令或mixins(@ mgreter,#1550)中定义函数'

Obviously, _lists.scss in compass-mixins break this rule. Seems someone raise an issue to compass-mixins and they have idea on fixing it.

显然,指南针混合中的_lists.scss打破了这个规则。似乎有人向罗盘混音师提出了一个问题,他们有解决问题的想法。

Before compass-mixins release the issue fixed version, my temporary workaround is to delete node_modules/node-sass manually and npm install node-sass@3.4.2

在compass-mixins发布问题修复版之前,我的临时解决方法是手动删除node_modules / node-sass并且npm install node-sass@3.4.2

#2


2  

I had the same issue,please refer to node sass release 3.5.3 is breaking build and force lock gulp-sass to use the specific node sass library using shrinkwrap and avoid using the buggy version of node sass

我有同样的问题,请参考节点sass版本3.5.3正在打破构建和强制锁定gulp-sass使用特定节点sass库使用shrinkwrap并避免使用节点sass版本的sass

#3


1  

I am using Gulp. Version 2.3.0 of gulp-sass breaks it. Go back to Version 2.2.0 and you are all fixed.

我正在使用Gulp。版本2.3.0的gulp-sass打破了它。回到2.2.0版本,你们都修复了。

Edit:

编辑:

The real culprit is the node module inside the "gulp-sass" node module known as "node-sass". You can see inside "gulp-sass"'s package.json file that it simply pulling version greater than ^3.5.3.

真正的罪魁祸首是“gulp-sass”节点模块中的节点模块,称为“node-sass”。您可以在“gulp-sass”的package.json文件中看到它只是拉大于^ 3.5.3的版本。

Even if you go back and reinstall "gulp-sass" to 2.2.0, as I suggested earlier, the package.json file in there will still pull "node-sass" greater than ^3.5.3.

即使你回去并重新安装“gulp-sass”到2.2.0,正如我之前建议的那样,那里的package.json文件仍会将“node-sass”拉大于^ 3.5.3。

If I use the older version of "node-sass" 3.4.2 that error goes away. I don't know how to fix that in an automated way. In a pinch I was able to fix the problem by copying that folder (that is using 3.4.2) from a different project that works. Now it compiles.

如果我使用旧版本的“node-sass”3.4.2,那么错误就会消失。我不知道如何以自动方式解决这个问题。在紧要关头,我能够通过从一个有效的不同项目中复制该文件夹(即使用3.4.2)来解决问题。现在它编译。

Can someone smarter than me figure out a better way to accomplish this result?

能比我聪明的人找到更好的方法来实现这个结果吗?

#4


1  

What I (temporarily) did, was to install globally the node-sass v3.4.2, and then replace the gulp-sass version of node-sass (it is located within gulp-sass/node_modules) with this older one.

我(暂时)做的是全局安装node-sass v3.4.2,然后用这个较旧的版本替换node-sass的gulp-sass版本(它位于gulp-sass / node_modules中)。

sudo npm install -g node-sass@3.4.2;
sudo cp -r /usr/lib/node_modules/node-sass/ /usr/lib/node_modules/gulp-sass/node_modules/;

#5


1  

Btw, there is a PR waiting to be merged for this. But if you want to use this today then there's a fork of the merge too.
If you want to use latter then just put compass-mixins: tjenkinson/compass-mixins in your package.json and all will be good.

顺便说一下,有一个公关等待合并。但是如果你今天想要使用它,那么合并的分叉也是如此。如果你想使用后者,那么只需将compass-mixins:tjenkinson / compass-mixins放入你的package.json中,一切都会好的。

Update:- There's also an npm package for the latter mentioned in the PR now

更新: - 现在PR还提到了后者的npm包

Update 2:- This should no longer be a problem with v0.12.8 now

更新2: - 现在不再是v0.12.8的问题了