pkg icon indicating copy to clipboard operation
pkg copied to clipboard

PKG Dependency has an issue

Open denysovkos opened this issue 6 years ago • 10 comments

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

denysovkos avatar Mar 30 '20 17:03 denysovkos

I got the same issue

GiladShoham avatar Mar 31 '20 09:03 GiladShoham

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)

kundralaci avatar Mar 31 '20 21:03 kundralaci

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?

  • pkg -t node8.16.0-linux-armv7 --output result package.json /node/node-v8.9.4/lib/node_modules/pkg/node_modules/pkg-fetch/node_modules/fs-ex tra/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: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. (/node/node-v8.9.4/lib/node_modules/pkg/node_modules/p kg-fetch/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

isabel-ordas avatar Apr 03 '20 09:04 isabel-ordas

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:

  1. installing [email protected] with "npm install -g [email protected]"
  2. modifying "/usr/local/lib/node_modules/pkg/package.json", setting pkg-fetch to "2.6.4" instead of "^2.6.4"
  3. removing "/usr/local/lib/node_modules/pkg/node_modules"
  4. calling npm update in "/usr/local/lib/node_modules/pkg"

AllenChung9 avatar Apr 03 '20 15:04 AllenChung9

Ditto

lauraerinmann avatar Apr 03 '20 22:04 lauraerinmann

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)

I had the same issue using node 8.10.0 After upgrading my node version to 10.13.0 the error was gone

stevenosse avatar Jun 18 '20 13:06 stevenosse

I am on node v14.7.0 and I am still seeing the issue.

webdevmorgan avatar Aug 10 '20 16:08 webdevmorgan

Same on v12.16.1

zsteinerjc avatar Aug 12 '20 20:08 zsteinerjc

Happens to me with node 12.18.3...

AlexanderTunick avatar Aug 21 '20 04:08 AlexanderTunick

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

AryanChothani avatar Nov 03 '20 11:11 AryanChothani