Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError [ERR_INVALID_ARG_TYPE] #303

Open
tiagohintz opened this issue Sep 10, 2021 · 6 comments
Open

TypeError [ERR_INVALID_ARG_TYPE] #303

tiagohintz opened this issue Sep 10, 2021 · 6 comments

Comments

@tiagohintz
Copy link

tiagohintz commented Sep 10, 2021

When starting the new project after installing and configuring meteor-desktop it displays the error (Note: This only happens in Meteor version 2.3 and above "Node 14", in versions with Node 12 and 10 the problem does not occur):

[meteor-desktop] calculated .desktop hash version is 8704ea9ec60f81720ae71a4fbc0216d38581a0aa_dev
internal/fs/utils.js:793                      
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (fs.js:1517:5)
    at Module.<anonymous> (/Users/tiagohintz/.meteor/packages/meteor-tool/.2.3.6.1s8cqvg.rum1k++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1641:23)
    at packages/meteor-desktop-bundler/bundler.js:869:48
    at runAsync (/Users/tiagohintz/node_modules/@babel/core/lib/transformation/index.js:40:10)
    at /Users/tiagohintz/node_modules/@babel/core/lib/transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Project details:
meteor: 2.3.6 (Blaze)
meteor-desktop: 2.2.5
electron: 6.1.7
electron-builder: 21.2.0
jquery: 3.5.1
OS: MacOS - Darwin 192.168.1.12 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Tanks

@tiagohintz
Copy link
Author

Also tested with Meteor version 2.4 (Blaze) and the same error occurs.

@AmitDigga
Copy link

Any one solved it yet?

@cfesas01
Copy link

cfesas01 commented Dec 7, 2021

Same issue

@wildhart
Copy link

wildhart commented Jan 31, 2022

I've tracked it down to this code in

fs.writeFileSync(filePath, uglifiedCode);

image

In development mode, uglifiedCode will be undefined, which causes an error since fs.writeFileSync introduced type checking of the data parameter in Node 14.

My work-around is to copy the /plugins/bundler folder into my project's /packages folder (so that Meteor uses my local copy of the package), then change that line to uglifiedCode || code.

@wildhart
Copy link

Also, all these warnings are produced by meteor-desktop's dependency on [email protected]. To remove these warnings this should be updated to >= 0.8.4 ref shelljs/shelljs#991 (comment)

(node:20512) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:20512) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:20512) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
...

@evan-coygo
Copy link
Contributor

evan-coygo commented Feb 14, 2022

I've included your fixes in a pull request to the Meteor-Community org's fork of this package since this is no longer maintained Meteor-Community-Packages#7 . I'm hoping to get this published as meteor-desktop version 2.2.6

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

No branches or pull requests

5 participants