2016-03-04 139 views
2

我有一个Sails Api,它第一次启动就像一个魅力。 按CTRL + C停止它,然后尝试再次启动它。它的作品,但是,Grunt错误SailsJS使用--no-frontend解除

error: ** Grunt :: An error occurred. ** 
error: 
------------------------------------------------------------------------ 
Aborted due to warnings. 
Running "clean:dev" (clean) task 
Warning: Cannot delete files outside the current working directory. 
------------------------------------------------------------------------ 

error: Looks like a Grunt error occurred-- 
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets) 
error: Or if you're stuck, check out the troubleshooting tips below. 

error: Troubleshooting tips: 
error: 
error: *-> Are "grunt" and related grunt task modules installed locally? Run `npm install` if you're not sure. 
error: 
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc. 
error: 
error: *-> Or maybe you don't have permissions to access the `.tmp` directory? 
error:  e.g., `folderthingy` ? 
error: 
error:  If you think this might be the case, try running: 
error:  sudo chown -R 501 folderthingy 

嗯,我检查一切,该文件夹只是我自己的,有足够的权利。我也为了测试目的而搭建了777,但这并没有改变。

然后,我决定清除.tmp文件夹的所有内容,并尝试重新启动。这就像一个魅力,.tmp再次填充,当我停止服务器,试图重新启动它,我又得到了完全相同的错误消息!

我用--no-frontend选项启动,所以实际上我不明白它为什么要加载grunt。

这究竟是为什么?这里有什么问题?

+0

修正显示在这里:http:// stackoverflow。com/questions/35624877/sails-js-permissions – cfl

回答

2

为什么发生这种情况仍然不为人类所知,但我通过删除Gruntfile来修复它。

0

如果您正在使用Linux,请尝试执行sudo sails lift,您可能遇到权限问题(发生在我身上)。如果是Windows - 检查没有文件管理器或其他程序阻止.tmp文件夹(当我在Total Commander中打开文件夹时也发生在我身上)。 在任何情况下,由于您不使用前端,您可以简单地删除一些grunt任务(在文件夹任务中/您有README.md,它解释在哪种情况下运行哪些任务)或全部(请参阅documentation)和你不会有这个问题。

+0

我使用MacOsx,我想知道为什么错误会弹出:) – Chilion

+0

options:{force:true},可以在tasks/config/clean.js中设置。这解决了问题 – cfl

+1

@cfl它不会帮助我描述的情况下 – amberv

0

我有同样的问题,而下面这个教程: https://www.youtube.com/watch?v=ZE7ye2G_H9Q&index=4&list=PLf8i4fc0zJBzLhOe6FwHpGhBDgqwInJWZ

我创建了一个“链接”文件夹,因为这家伙做了什么,然后促使我与错误。看起来他正在使用旧版本的SailsJS,因为他没有遇到任何错误。

你有没有在资产文件夹中创建一个新文件夹?如果你这样做了,问题在于grunt无法在特定文件夹上运行任务,因为它没有与其他assets文件夹和文件链接。尝试将所有新创建的文件放在已存在的文件夹中,然后重试。这对我有效。

+0

不,我没有。修正了它,但删除了gruntfile – Chilion

0

我也得到这个错误 -

error: ** Grunt :: An error occurred. ** 
error: 
------------------------------------------------------------------------ 
Aborted due to warnings. 
Running "sass:dev" (sass) task 

    > error: Looks like a Grunt error occurred-- 
    > 
    > error: Please fix it, then **restart Sails** to continue running tasks 
    > (e.g. watching for changes in assets) 
    > 
    > error: Or if you're stuck, check out the troubleshooting tips below. 

error: Troubleshooting tips: 
error: 
error: *-> Are "grunt" and related grunt task modules installed locally? Run `npm install` if you're not sure. 
error: 
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc. 
error: 
error: *-> Or maybe you don't have permissions to access the `.tmp` directory? 
error:  e.g., `/Users/siyaram.malav/Desktop/repo/project1/.tmp` ? 

这个错误来了,因为它找不到SASS module.And运行以下命令

sudo的创业板安装青菜

它为我工作。

在你的情况下,试试运行sudo gem install clean命令。

它应该工作。 谢谢。