max-mapper / extract-zip

Zip extraction written in pure JavaScript. Extracts a zip into a directory.
BSD 2-Clause "Simplified" License
388 stars 126 forks source link

SyntaxError: Octal literals are not allowed in strict mode. [bug] #57

Closed damianobarbati closed 6 years ago

damianobarbati commented 6 years ago

My node runs by default in strict_mode, how to overcome this bug?

0|GoatSolo | /Users/damz/Desktop/goatsolo/node_modules/extract-zip/node_modules/mkdirp/index.js:19
0|GoatSolo |         mode = 0777 & (~process.umask());
0|GoatSolo |                ^^^^
0|GoatSolo | SyntaxError: Octal literals are not allowed in strict mode.
0|GoatSolo |     at createScript (vm.js:80:10)
0|GoatSolo |     at Object.runInThisContext (vm.js:139:10)
0|GoatSolo |     at Module._compile (module.js:588:28)
0|GoatSolo |     at Object.Module._extensions..js (module.js:635:10)
0|GoatSolo |     at Module.load (module.js:545:32)
0|GoatSolo |     at tryModuleLoad (module.js:508:12)
0|GoatSolo |     at Function.Module._load (module.js:500:3)
0|GoatSolo |     at Module.require (module.js:568:17)
0|GoatSolo |     at require (internal/module.js:11:18)
0|GoatSolo |     at Object.<anonymous> (/Users/damz/Desktop/goatsolo/node_modules/extract-zip/index.js:4:14)
fczuardi commented 6 years ago

mkdirp 0.5.1 fixes this issue, so bumping the dependency should be enough see https://github.com/substack/node-mkdirp/commit/48e67fce39f1a5f2aba6196301b7be6d4545d6cf

fczuardi commented 6 years ago

for any projects needing this fix, if you use yarn there is a workaround, you could use the resolutions field to have the 0.5.1 version as the only one installed. Manually add this to your package.json:

  "resolutions": { 
    "mkdirp": "^0.5.1" 
  } 

About this yarn feature: https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

fczuardi commented 6 years ago

or if you want to get a surgically specific override you could do something like this:

  "resolutions": {
    "@storybook/addon-storyshots/puppeteer/extract-zip/mkdirp": "^0.5.1"
  }

To have only the mkdirp used by extract-zip used by puppeteer used by @storybook/addon-storyshots modified :)