Skip to content

yarnpkg run build failing due to mkdirSync #288

@cmunk

Description

@cmunk

The following line (webpack-bundle-tracker/lib/index.js:89)
fs.mkdirSync(this.outputTrackerDir, { recursive: true, mode: 0o755 });

Causes our build to fail as the outputTrackerDir already exists:

yarn run v1.13.0
$ yarnpkg run clean && yarnpkg run copy:assets && yarnpkg run build:js
$ rm -rf $npm_package_build_dir
$ cp -r $npm_package_src_dir/images $npm_package_build_dir && cp $npm_package_src_dir/favicon.ico $npm_package_build_dir/ && yarnpkg update:alert
$ cp ./static/maintenance-alert.js $npm_package_build_dir/
$ webpack --mode development
Green env is set to: undefined
/git/bbd/src/green
fs.js:885
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EEXIST: file already exists, mkdir '/git/bbd/src/green'
    at Object.fs.mkdirSync (fs.js:885:18)
    at BundleTrackerPlugin._writeOutput (/git/bbd/src/green/node_modules/webpack-bundle-tracker/lib/index.js:89:8)
    at BundleTrackerPlugin._handleCompile (/git/bbd/src/green/node_modules/webpack-bundle-tracker/lib/index.js:115:10)
    at SyncHook.eval [as call] (eval at create (/git/bbd/src/green/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (/git/bbd/src/green/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.beforeCompile.callAsync.err (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:665:23)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/git/bbd/src/green/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/git/bbd/src/green/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:662:28)
    at readRecords.err (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:321:11)
    at Compiler.readRecords (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:529:11)
    at hooks.run.callAsync.err (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:318:10)
    at _err0 (eval at create (/git/bbd/src/green/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at compiler.hooks.run.tapAsync (/git/bbd/src/green/node_modules/webpack/lib/CachePlugin.js:50:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/git/bbd/src/green/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/git/bbd/src/green/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.beforeRun.callAsync.err (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:315:19)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/git/bbd/src/green/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/git/bbd/src/green/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.run (/git/bbd/src/green/node_modules/webpack/lib/Compiler.js:312:24)
    at processOptions (/git/bbd/src/green/node_modules/webpack-cli/bin/cli.js:353:14)
    at yargs.parse (/git/bbd/src/green/node_modules/webpack-cli/bin/cli.js:364:3)
    at Object.parse (/git/bbd/src/green/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
    at /git/bbd/src/green/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/git/bbd/src/green/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Perhaps there should be a check for dir first, before an attempt to create it is made?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions