gpt4 book ai didi

node.js - 运行 Grunt 时 path.resolve 的参数必须是字符串

转载 作者:IT老高 更新时间:2023-10-28 23:10:13 25 4
gpt4 key购买 nike

我的 Grunt 文件:

module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

ts: {
dev: {
src: ["src/background/*.ts"],
out: ["build/background.js"],
}
}
});

grunt.loadNpmTasks("grunt-ts");
grunt.registerTask("default", ["ts:dev"]);
};

(我正在使用 grunt-ts 。)

系统信息

  • Windows 8.1
  • NodeJS v0.10.24
  • grunt-cli v0.1.11
  • 咕噜 v0.4.2

我已经在网上搜索了很多关于这个错误的资源,但是他们都说应该升级 NodeJS 和/或 Grunt。我已经试过了。我什至完全重新安装了 Grunt,但是错误仍然存​​在。


完整的错误信息:

P:\my-folder>grunt ts
Running "ts:dev" (ts) task
Warning: Arguments to path.resolve must be strings Use --force to continue

Aborted due to warnings.

package.json

{
"name": "regex-search",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-ts": "~1.5.1"
}
}

最佳答案

在将我的 Gruntfile 与官方提供的 sample file 进行比较之后,我发现我的真的很傻的错误:

ts: {
dev: {
src: ["src/background/*.ts"],
out: ["build/background.js"],
}
}

out 不能是一个数组!
正确版本:

ts: {
dev: {
src: ["src/background/*.ts"],
out: "build/background.js",
}
}

关于node.js - 运行 Grunt 时 path.resolve 的参数必须是字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20937488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com