Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

PKG Dependency has an issue #883

Closed
denysovkos opened this issue Mar 30, 2020 · 10 comments
Closed

PKG Dependency has an issue #883

denysovkos opened this issue Mar 30, 2020 · 10 comments

Comments

@denysovkos
Copy link

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

@GiladShoham
Copy link

I got the same issue

GiladShoham added a commit to teambit/bit that referenced this issue Mar 31, 2020
GiladShoham added a commit to teambit/bit that referenced this issue Mar 31, 2020
* upgrade react-docgen from 4.x to 5.x.

* resolve #2487, fix react docs of union type prop

* update pkg version

* disable pack temporary because of vercel/pkg#883

Co-authored-by: Gilad Shoham <[email protected]>
@kundralaci
Copy link

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)

@isabel-ordas
Copy link

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)

@ac9
Copy link

ac9 commented Apr 3, 2020

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"

@lauraerinmann
Copy link

Ditto

@stevenosse
Copy link

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

@webdevmorgan
Copy link

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

@zsteinerjc
Copy link

Same on v12.16.1

@AlexanderTunick
Copy link

Happens to me with node 12.18.3...

@AryanChothani
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests