ENOENT on writeFileSync works on repl fails on gulp-asset-manifest
ENOENT on writeFileSync works on repl fails on gulp-asset-manifest
我正在使用 this site 上的代码为 Windows aspnet + angularjs 应用程序编写 gulp 文件。
我 运行 目前只使用样式,当我 运行 gulp 我得到:
Error: ENOENT, no such file or directory 'C:\project\build\manifest-debug.json'
at Error (native)
at Object.fs.openSync (fs.js:502:18)
at Object.fs.writeFileSync (fs.js:1103:15)
at writeManifestFile (C:\project\node_modules\gulp-asset-manifest\index.js:30:8)
at resetManifestFile (C:\project\node_modules\gulp-asset-manifest\index.js:51:5)
at module.exports (C:\project\node_modules\gulp-asset-manifest\index.js:76:5)
at getManifest (C:\project\Gulpfile.js:97:12)
at Gulp.<anonymous> (C:\project\Gulpfile.js:126:15)
at module.exports (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
看着 C:\project\node_modules\gulp-asset-manifest\index.js:30:8
我明白了:
fs.writeFileSync(filename, JSON.stringify(data));
所以我 运行 在节点的 REPL 上这样做:
fs.writeFileSync('C:\project\build\manifest-debug.json', 'hi');
文件创建正确。
我用现有文件再次尝试 运行ning gulp,但得到了完全相同的错误。
我在 index.js 的第 30 行之前添加了一个 console.log(filename);
,我得到:
./build/manifest-debug.json
所以我 运行 fs.writeFileSync('./build/manifest-debug.json', 'hi');
在同一文件夹的 REPL 上,它也有效。
不确定发生了什么。
我正在 运行禁用 UAC 并在具有管理员权限的命令提示符下进行所有操作。
问题是 fs.writeFileSync 需要路径存在。
在调用 gulp-asset-manifest
时 ./build
不存在,因为 clean
任务删除了整个路径。
我正在使用 this site 上的代码为 Windows aspnet + angularjs 应用程序编写 gulp 文件。
我 运行 目前只使用样式,当我 运行 gulp 我得到:
Error: ENOENT, no such file or directory 'C:\project\build\manifest-debug.json'
at Error (native)
at Object.fs.openSync (fs.js:502:18)
at Object.fs.writeFileSync (fs.js:1103:15)
at writeManifestFile (C:\project\node_modules\gulp-asset-manifest\index.js:30:8)
at resetManifestFile (C:\project\node_modules\gulp-asset-manifest\index.js:51:5)
at module.exports (C:\project\node_modules\gulp-asset-manifest\index.js:76:5)
at getManifest (C:\project\Gulpfile.js:97:12)
at Gulp.<anonymous> (C:\project\Gulpfile.js:126:15)
at module.exports (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
看着 C:\project\node_modules\gulp-asset-manifest\index.js:30:8
我明白了:
fs.writeFileSync(filename, JSON.stringify(data));
所以我 运行 在节点的 REPL 上这样做:
fs.writeFileSync('C:\project\build\manifest-debug.json', 'hi');
文件创建正确。
我用现有文件再次尝试 运行ning gulp,但得到了完全相同的错误。
我在 index.js 的第 30 行之前添加了一个 console.log(filename);
,我得到:
./build/manifest-debug.json
所以我 运行 fs.writeFileSync('./build/manifest-debug.json', 'hi');
在同一文件夹的 REPL 上,它也有效。
不确定发生了什么。
我正在 运行禁用 UAC 并在具有管理员权限的命令提示符下进行所有操作。
问题是 fs.writeFileSync 需要路径存在。
在调用 gulp-asset-manifest
时 ./build
不存在,因为 clean
任务删除了整个路径。