【问题标题】:Grunt Cannot delete files outside the current working directoryGrunt 无法删除当前工作目录之外的文件
【发布时间】:2016-09-13 23:58:45
【问题描述】:

我正在尝试使用 yeoman 创建一个 HelloWorld angularjs 应用程序。安装完所有东西并生成应用程序后,我使用命令 grunt 启动应用程序,但出现此错误

Running "clean:server" (clean) task
Warning: Cannot delete files outside the current working directory. Use --force to continue.

Aborted due to warnings.

我在我的 grunt 文件中添加了 force:true,但又遇到了另一个错误

clean: {
      options: {
    force: true
  },
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git{,*/}*'
          ]
        }]
      },
      server: '.tmp'
    },

警告:无法删除“.tmp”文件(EACCES:权限被拒绝, 取消链接“.tmp/styles”)。使用 --force 继续。

【问题讨论】:

  • 请添加有关您正在使用的gruntyeoman(包括生成器)版本的更多信息。
  • 查看grunt-contrib-clean 的文档,我想有一个cwd 属性可以解决这个问题

标签: angularjs gruntjs yeoman


【解决方案1】:

你可以试试:

clean: {
	dist: {
		options: {
			force: true
		},
		files: [{
			dot: true,
			src: [
				'.tmp',
				'<%= yeoman.dist %>/{,*/}*',
				'!<%= yeoman.dist %>/.git{,*/}*'
			]
		}]
	},
	server: '.tmp'
},

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多