指南针:dist&execFile(“compass.bat”,...)-警告:产生EPERM

3

首先,我对(现代)Web开发还比较陌生,我试图将一个现有的项目导入到我的WebStorm中并运行Grunt任务。

它在"compass:dist"处停止,显示如下:

$ node.exe C:\Users\lgr\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt --gruntfile C:\Users\lgr\workspace\js\rit-workshop\ui\Gruntfile.js buildall
    Initializing
Command-line options: --gruntfile=C:\Users\lgr\workspace\js\rit-workshop\ui\Gruntfile.js, --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-bump" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-bump\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-bump\package.json...OK
Loading "bump.js" tasks...OK
+ bump, bump-commit, bump-only

Registering "grunt-html2js" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-html2js\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-html2js\package.json...OK
Loading "html2js.js" tasks...OK
+ html2js

Registering "grunt-contrib-clean" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-clean\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-clean\package.json...OK
Loading "clean.js" tasks...OK
+ clean

Registering "grunt-contrib-copy" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-copy\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-copy\package.json...OK
Loading "copy.js" tasks...OK
+ copy

Registering "grunt-contrib-concat" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-concat\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-concat\package.json...OK
Loading "concat.js" tasks...OK
+ concat

Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-cssmin\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-cssmin\package.json...OK
Loading "cssmin.js" tasks...OK
+ cssmin

Registering "grunt-contrib-watch" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-watch\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-watch\package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-contrib-jshint" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-jshint\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-jshint\package.json...OK
Loading "jshint.js" tasks...OK
+ jshint

Registering "grunt-contrib-uglify" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-uglify\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-uglify\package.json...OK
Loading "uglify.js" tasks...OK
+ uglify

Registering "grunt-karma" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-karma\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-karma\package.json...OK
Loading "grunt-karma.js" tasks...OK
+ karma

Registering "grunt-conventional-changelog" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-conventional-changelog\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-conventional-changelog\package.json...OK
Loading "changelog.js" tasks...OK
+ changelog

Registering "grunt-ngdocs" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-ngdocs\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-ngdocs\package.json...OK
Loading "grunt-ngdocs.js" tasks...OK
+ ngdocs

Registering "grunt-contrib-compass" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-compass\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-compass\package.json...OK
Loading "compass.js" tasks...OK
+ compass

Registering "grunt-contrib-requirejs" local Npm module tasks.
Reading C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-requirejs\package.json...OK
Parsing C:\Users\lgr\workspace\js\rit-workshop\ui\node_modules\grunt-contrib-requirejs\package.json...OK
Loading "requirejs.js" tasks...OK
+ requirejs
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
- watch
+ BuildCommit, after-test, archive, archiveNONmin, buildall, buildjs, buildjsCommit, buildjsNONmin, buildjsNONminCommit, css, cssmy, default, delta, incrementBuild, shell, templates, test, watch

Running tasks: buildall

Running "buildall" task

Running "clean:buildall" (clean) task
Verifying property clean.buildall exists in config...OK
Files: [no src]
Options: force=false, no-write=false
>> 0 paths cleaned.

Running "css" task

Running "compass" task

Running "compass:dist" (compass) task
Verifying property compass.dist exists in config...OK
File: [no files]
Options: config="config.rb"
Warning: spawn EPERM Use --force to continue.

Aborted due to warnings.

我尝试过搜索一些资料,但是似乎这是一个权限错误,但我不知道从哪里开始修复它。
我尝试过清理项目、重新安装Windows版Ruby以及在Ruby中重新安装compass,但都没有起作用。
更新:
我尝试进行构建调试,在文件bin-version\index.js中的一行代码。
execFile(bin, ['--version'], function (err, stdout, stderr) {

似乎出现了错误,因为调试器无法超越此点。 bincompass.bat,看起来构建过程中出现了一些权限错误? 当我打开我的 cmd 并输入 "compass --version" 时,它可以正常工作。 我的 classpath 中也有 ruby/bin,其中放置了 compass.bat。

Running "compass:dist" (compass) task
Verifying property compass.dist exists in config...OK
File: [no files]
Options: config="config.rb"
Warning: spawn EPERM Use --force to continue.

有人知道是什么原因导致了这个错误吗?


使用"--verbose"运行你的gruntfile,以查看EPERM问题发生在哪个文件上。 - Pete TNT
@PeteTNT 感谢您的评论。我已经使用--verbose输出编辑了问题。不幸的是,我仍然无法确定错误发生的位置。 - luuksen
你使用的Node版本是多少?尝试调试你的Grunt任务以查看错误来自何处:创建一个类似以下的Node.js运行配置:工作目录:Grunfile.js所在的目录。 Javascript文件:C:\Users\lgr\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt。应用程序参数:要运行的grunt任务。在你的Gruntfile.js中添加断点,开始调试。 - lena
你好@lena,我按照你说的设置了一个node.js运行配置,但是我不知道在哪里设置断点?错误是在任务“'css'”中抛出的,该任务由grunt.registerTask('css', ['compass']);注册。compass由compass:{ dist: { options: { config: 'config.rb' } } }初始化。 - luuksen
尝试在your_project\node_modules\grunt-contrib-compass\tasks\lib\compass.js中的exports.buildConfigContext函数中设置断点。似乎grunt正在尝试在tmp目录中创建临时config.rb文件,由于权限不足而失败。 - lena
嗨@lena,到目前为止,感谢您的帮助。我调试了构建过程,并认为错误是在文件bin-version\index.js的第execFile(bin, ['--version'], function (err, stdout, stderr) {行中抛出的,其中bin"compass.bat"。当我打开标准的cmd时,我可以键入“compass --version”,一切都正常工作。您有什么想法可能吗?它不会超越那个点。之后控制台会抛出:“致命错误:生成EPERM”。 - luuksen
1个回答

1
我解决了这个问题,但无法确切地说明是什么原因导致的。我能说的是,它与指南针本身、错误的权限或Windows无关,而是与错误的项目设置有关。所以,如果您遇到此错误,请检查您的设置并确保每个依赖项都可用。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接