jprichardson / node-fs-extra

Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
MIT License
9.47k stars 772 forks source link

make-dir catch error on Node.js v14.15.1 and v14.15.4 #857

Closed Kennytian closed 3 years ago

Kennytian commented 3 years ago
export PATH="$PATH:/***/.nvm/versions/node/v14.15.1/bin"

...

nest build
out: 
err: /var/www/backend/yios-task-development/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
err:       } catch {
err:               ^
err: 
err: SyntaxError: Unexpected token {
err:     at createScript (vm.js:80:10)
err:     at Object.runInThisContext (vm.js:139:10)
err:     at Module._compile (module.js:616:28)
err:     at Object.Module._extensions..js (module.js:663:10)
err:     at Module.load (module.js:565:32)
err:     at tryModuleLoad (module.js:505:12)
err:     at Function.Module._load (module.js:497:3)
err:     at Module.require (module.js:596:17)
err:     at require (internal/module.js:11:18)
RyanZim commented 3 years ago

@Kennytian What is nest build?

Kennytian commented 3 years ago

@RyanZim https://github.com/nestjs/typescript-starter/blob/master/package.json#L9

https://github.com/nestjs/schematics/blob/master/package.json#L45

https://github.com/kamilmysliwiec

RyanZim commented 3 years ago

OK, I'm trying to pin down if nest is related to your issue or not. If you create a file with the contents require('fs-extra'), and run it with node <file>, do you get an error in your environment?

Kennytian commented 3 years ago

Thank you for your fast reply, today it’s too late (11:40 PM in China), I will provide more details error message at tomorrow. Thanks again

Kennytian commented 3 years ago

@RyanZim Thanks RyanZim, it's my fault and find really reason, CI login my server use /usr/bin/node,this node runtime is 'v8.10.0', so i update my CI script, add export PATH="/root/.nvm/versions/node/v14.15.4/bin:$PATH", fs-extra is working.