Hi! There is an issue with fs-extra. Even when you try to get a version, you will get this:
pkg -v
/usr/lib/node_modules/pkg/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.(/usr/lib/node_modules/pkg/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
This happens on all versions after 4.4.0
I got the same issue
Happens to me as well. I'm trying to run it in Google Cloud Build, using the gcr.io/cloud-builders/npm builder image. I've tried the latest 4.4.5, and then downgraded to 4.4.4. It has been running well for years, and now suddenly it broke. Here's the log:
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
/usr/local/bin/pkg -> /usr/local/lib/node_modules/pkg/lib-es5/bin.js
+ [email protected]
added 126 packages from 152 contributors in 5.497s
/usr/local/lib/node_modules/pkg/node_modules/pkg-fetch/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/pkg/node_modules/pkg-fetch/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
This happened to me as well. I do not know how to solve this. Why it is happening even in older tags if they did not change?
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.
I have encountered this issue as well with the same error. My workaround is to enforce an older version, [email protected] and [email protected] which uses [email protected] instead. This is done by:
Ditto
Happens to me as well. I'm trying to run it in Google Cloud Build, using the
gcr.io/cloud-builders/npmbuilder image. I've tried the latest 4.4.5, and then downgraded to 4.4.4. It has been running well for years, and now suddenly it broke. Here's the log:npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) /usr/local/bin/pkg -> /usr/local/lib/node_modules/pkg/lib-es5/bin.js + [email protected] added 126 packages from 152 contributors in 5.497s /usr/local/lib/node_modules/pkg/node_modules/pkg-fetch/node_modules/fs-extra/lib/mkdirs/make-dir.js:86 } catch { ^ SyntaxError: Unexpected token { at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:617:28) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object.<anonymous> (/usr/local/lib/node_modules/pkg/node_modules/pkg-fetch/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
I had the same issue using node 8.10.0
After upgrading my node version to 10.13.0 the error was gone
I am on node v14.7.0 and I am still seeing the issue.
Same on v12.16.1
Happens to me with node 12.18.3...
After Updating Node version Rebuild node packages
cd /to/root/of/your/project
npm rebuild
npm i -g pm2 && pm2 update
=here 0 and dist/main.js change for your project
pm2 delete 0 && pm2 start dist/main.js
Link to the Answer of stackoverflow
This worked for me easily
Most helpful comment
I am on node v14.7.0 and I am still seeing the issue.