kriscross07 / atom-gpp-compiler

An atom package that allows you to compile and run C++ and C within the editor.
https://atom.io/packages/gpp-compiler
80 stars 228 forks source link

Uncaught Callback must be a function #301

Open mgentyala opened 4 years ago

mgentyala commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.43.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Home Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:129

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1137:14)
    at ChildProcess.child.on (/packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

Commands

 10x -0:45.7.0 gpp-compiler:compile (input.hidden-input)
     -0:27.4.0 editor:toggle-line-comments (input.hidden-input)
  3x -0:26.3.0 core:move-down (input.hidden-input)
     -0:24.1.0 editor:toggle-line-comments (input.hidden-input)
     -0:20.9.0 core:save (input.hidden-input)
     -0:19.5.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

atom-java-snippets 0.5.1 
atom-live-server 2.3.0 
atom-live-server-plus 3.0.1 
autocomplete-java 1.2.7 
basic-java-compile 0.2.1 
busy 0.7.0 
google-java-format 0.0.4 
gpp-compiler 3.0.7 
ide-java 0.9.0 
java-class-complete 0.0.6 
java-classpath-registry 0.4.0 
java-generator 2.2.3 
java-generator-plus 2.6.0 
java-import-wiz 0.5.0 
java-importer 1.4.1 
java-plus 0.1.0 
script 3.25.0 
spring-boot 1.8.0 
keertz-tech commented 4 years ago

I'm experiencing the same issue as well hope a good solution pops up!

orionnelson commented 4 years ago

I had this issue It appears I can only have one command window open at a time or else I receive this error. Currently using GCC with MinGW 32 bit.

orionnelson commented 4 years ago

I had this issue It appears I can only have one command window open at a time or else I receive this error. Currently using GCC with MinGW 32 bit.

I am having this issue as well with MinGW 32 bit. What do you mean that it works with only one command window open at a time?

Sorry about being vague with the first response. With all of the above steps mentioned by MadhubabuGentyala completed ( I had a similar install ) however did not have any of the java compiler packages and instead had some linter ones as I was using C .

While this is not exactly the issue described above I found that I was calling the wrong version of my compiler.

Brief Explanation: As I followed a tutorial installing clang I installed it using msys64 where I also installed 64 bit mingw. Since I had just installed clang using its msys64 directory and I tried to run gpp-compiler doing the same thing. C:\msys64\mingw64\bin\gcc.exe not in Environment Variables and does not work. -I believe it was above what was giving me the error but was not able to recreate it just now. ERR_INVALID_CALLBACK Instead of C:\MinGW\bin\gcc.exe which is where my 32 bit version of MinGW I installed earlier and is an environment variable. Type path into cmd and see which you have installed.

In gpp-compiler settings type gcc, g++ what ever version you are using if it is in the EV directory. After this mine worked so I believe my error was just from an incorrect install.

Here are the packages I have installed: image

coopfpv commented 4 years ago

I have this issue and am completely new to Atom. I could really use some help.

Typing path into cmd gives me this:

PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\coope\AppData\Local\Microsoft\WindowsApps;C:\Users\coope\AppData\Local\atom\bin;C:\Users\coope\Downloads\Atom\bin;D:\source\bin;

This is my error message:

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.43.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Pro Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:129

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1137:14)
    at ChildProcess.child.on (/packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)

Commands

  2x -5:58.2.0 core:backspace (input.hidden-input)
  2x -0:58.7.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

gpp-compiler 3.0.7 
linter 2.3.1 
linter-gcc 0.9.0 
orionnelson commented 4 years ago

I have this issue and am completely new to Atom. I could really use some help.

Typing path into cmd gives me this:

PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\coope\AppData\Local\Microsoft\WindowsApps;C:\Users\coope\AppData\Local\atom\bin;C:\Users\coope\Downloads\Atom\bin;D:\source\bin;

This is my error message:

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.43.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Pro Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:129

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1137:14)
    at ChildProcess.child.on (/packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)

Commands

  2x -5:58.2.0 core:backspace (input.hidden-input)
  2x -0:58.7.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

gpp-compiler 3.0.7 
linter 2.3.1 
linter-gcc 0.9.0 

Hey you haven't installed MinGW at all and or have not added it to your path look this up online but after that it should work make sure you have all the packages required for linter such as clang after this it should work.

lanes100 commented 4 years ago

I have this issue and am completely new to Atom. I could really use some help.

Typing path into cmd gives me this:

PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\coope\AppData\Local\Microsoft\WindowsApps;C:\Users\coope\AppData\Local\atom\bin;C:\Users\coope\Downloads\Atom\bin;D:\source\bin;

This is my error message:

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.43.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Pro Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:129

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1137:14)
    at ChildProcess.child.on (/packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)

Commands

  2x -5:58.2.0 core:backspace (input.hidden-input)
  2x -0:58.7.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

gpp-compiler 3.0.7 
linter 2.3.1 
linter-gcc 0.9.0 

Hey you haven't installed MinGW at all and or have not added it to your path look this up online but after that it should work make sure you have all the packages required for linter such as clang after this it should work.

This is incorrect. It has been added to path and everything for me and I have clang installed and included in the path and nothing works.

lanes100 commented 4 years ago

Is there any update on this yet?

lanes100 commented 4 years ago

I had this issue It appears I can only have one command window open at a time or else I receive this error. Currently using GCC with MinGW 32 bit.

I am having this issue as well with MinGW 32 bit. What do you mean that it works with only one command window open at a time?

Sorry about being vague with the first response. With all of the above steps mentioned by MadhubabuGentyala completed ( I had a similar install ) however did not have any of the java compiler packages and instead had some linter ones as I was using C .

While this is not exactly the issue described above I found that I was calling the wrong version of my compiler.

Brief Explanation: As I followed a tutorial installing clang I installed it using msys64 where I also installed 64 bit mingw. Since I had just installed clang using its msys64 directory and I tried to run gpp-compiler doing the same thing. C:\msys64\mingw64\bin\gcc.exe not in Environment Variables and does not work. -I believe it was above what was giving me the error but was not able to recreate it just now. ERR_INVALID_CALLBACK Instead of C:\MinGW\bin\gcc.exe which is where my 32 bit version of MinGW I installed earlier and is an environment variable. Type path into cmd and see which you have installed.

In gpp-compiler settings type gcc, g++ what ever version you are using if it is in the EV directory. After this mine worked so I believe my error was just from an incorrect install.

Here are the packages I have installed: image

i followed what you said, and now i get "'gcc, g++' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process."

lanes100 commented 4 years ago

update for all. if you are trying to compile multiple files at once you have to select all of them and then run the program. if you do this it will work image (right click > compile and run)

Sandoplay commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.44.0 x64 Electron: 4.2.7 OS: Unknown Windows version Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:137

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at makeCallback (fs.js:137:11)
    at Object.unlink (fs.js:917:14)
    at fs.stat (/packages/gpp-compiler/index.js:427:14)
    at FSReqWrap.oncomplete (fs.js:155:5)

Commands

     -0:06.7.0 gpp-compiler:compile (div.highlights)

Non-Core Packages

busy-signal 2.0.1 
gpp-compiler 3.0.7 
intentions 1.1.5 
linter 2.3.1 
linter-clang 4.1.2 
linter-ui-default 1.8.1 
script 3.25.0 

Hmm such a strange thing. If i compile file in folder i have an error but it still compiles successfully but if i create a new folder and put that file there i dont get any error.

Austin3dPrinting commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.44.0 x64 Electron: 4.2.7 OS: Unknown Windows version Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:137

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at makeCallback (fs.js:137:11)
    at Object.unlink (fs.js:917:14)
    at fs.stat (/packages/gpp-compiler/index.js:427:14)
    at FSReqWrap.oncomplete (fs.js:155:5)

Commands

     -0:06.7.0 gpp-compiler:compile (div.highlights)

Non-Core Packages

busy-signal 2.0.1 
gpp-compiler 3.0.7 
intentions 1.1.5 
linter 2.3.1 
linter-clang 4.1.2 
linter-ui-default 1.8.1 
script 3.25.0 

Hmm such a strange thing. If i compile file in folder i have an error but it still compiles successfully but if i create a new folder and put that file there i dont get any error.

Yep that would appear to fix it for me. I ended up just putting my other C++ class practice programs in another sub folder and this made the error go away when running. Thank you!

snehasisbasu commented 4 years ago

If You keep the cmd (command module)window open then this error occurs.

Innovation1999 commented 4 years ago

Today, I found a way to fix that #319