Why am I getting errors running the coffee command in cygwin? - windows

I followed the CoffeeScript installation guide by installing Node.js with the node-v0.10.9-x64.msi installer. I then started up a cygwin console and cd'd into the directory with my .coffee file. If I type coffee all by itself, it gives me this error:
$ coffee
coffee>
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ENOTCONN
at errnoException (net.js:884:11)
at Socket._read (net.js:389:21)
at Socket.Readable.read (_stream_readable.js:320:10)
at Socket.read (net.js:291:43)
at new Socket (net.js:185:10)
at process.stdin (node.js:660:19)
at new REPLServer (repl.js:132:15)
at Object.exports.start (repl.js:312:14)
at Object.module.exports.start (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\repl.js:106:23)
at Object.exports.run (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:77:32)
at Object.<anonymous> (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\bin\coffee:7:41)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
And if I run the command with -lw it gives me this error:
$ coffee -lw Example.js.coffee
Error: This socket is closed.
at Socket._write (net.js:618:19)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at Socket.Writable.write (_stream_writable.js:180:11)
at Socket.write (net.js:596:40)
at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15)
at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
And if I run with just the -l option it gives me this error:
$ coffee -l Example.coffee
Error: This socket is closed.
at Socket._write (net.js:618:19)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at Socket.Writable.write (_stream_writable.js:180:11)
at Socket.write (net.js:596:40)
at lint (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:468:15)
at compileScript (C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:193:18)
at C:\Users\foo\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\command.js:144:18
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
But it seems like I can compile and/or watch option without the lint option and things work as expected.
I don't know anything about Node.js. I've tried googling these errors and I see similar ones related to ports in use and socket issues. I think it might be useful to note that I'm using Intellij IDEA (an IDE) and it has a CoffeeScript plugin which perhaps is interfering. But when I turn Intellij off I still get these same errors so that might be a red herring.
Also, perhaps there's a specific cygwin version of node.js I should have installed instead of the one I got from the installation instructions?
If I type node all by itself, it says this:
$ node
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ENOTCONN
at errnoException (net.js:884:11)
at Socket._read (net.js:389:21)
at Socket.Readable.read (_stream_readable.js:320:10)
at Socket.read (net.js:291:43)
at new Socket (net.js:185:10)
at process.stdin (node.js:660:19)
at startup (node.js:145:16)
at node.js:901:3

Unfortunately, node no longer supports Cygwin.
One workaround is to use some variety of MSysGit as a console instead of Cygwin, at least for running node/coffeescript. Git Bash supplies a good one. You can get it here.

Related

Cannot find module 'E:\husky\lib\bin.js'

I am using windows to bootstrap a Springboot backend using jhipster. I am running into the error below concerning Husky for git hooks.
> eims-back#0.0.0 prepare
> husky install
The system cannot find the path specified.
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'E:\husky\lib\bin.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.13.0
npm ERR! code 1
npm ERR! path E:\Software & Tutorials\Project source\EIMS_BE
How to I solve this?
I have searched online for that error but it seems new.
Check if this is similar to nodejs issue 3709, which includes some possible solution.
If, as commented, this is a NodeJS version, as seen here, follow the downgrade process.
JHipster is supposed to support node >=16.0.0 but maybe 18.x is too advanced.

Getting error when trying to run Ganache (forking BSC chain)

I have installed Ganache following instructions from https://github.com/trufflesuite/ganache#documentation
I am trying to fork BSC chain for which I have a node running locally which is fully synced (I want to fork this for which I have provided the URL in package.json under scripts).
When trying to run Ganache using npm run ganache it is giving me this error. Any idea how can I solve this?
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.__webpack_require__.f.require (/usr/local/lib/node_modules/ganache/dist/node/cli.js:2:21481)
at /usr/local/lib/node_modules/ganache/dist/node/cli.js:2:20777
at Array.reduce (<anonymous>)`
Supposedly it was supposed to run after this, so why i am getting this error?
Check your Node.js version:
node -v
v18.13.0
Version must be >= v14.0.0. After updating to the latest Node.js version, the error no longer occurred for me.

Cordova 4.3.0 - build command returns error Cannot find module 'Q'

After updating cordova to version 4.3.0 the command:
cordova build
returns the following error:
module.js:340
throw err;
^
Error: Cannot find module 'Q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/lib/check_reqs.js:25:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
ERROR building one of the platforms: Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have already tried to remove and add the platform ios but nothing changes.
I have tried to run:
sudo npm install -g cordova / sudo npm install cordova
sudo npm install -g Q / sudo npm install Q
but nothing changes.
Any help?
Thank you very much
There was a bug and I have released a patch to it:
Apache Cordova ios - Git Repository
This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).
So far, to fix it, you have to locate those files containing a line like this:
Q = require('Q')
You can locate the files while standing on your project directory using grep:
grep -HnrI "require('Q" *;
then, use any text editor to manually change the mentioned line to:
Q = require('q')
Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:
grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";
The single line above searches and edits the files that need the change.
Removing and then re-adding the platform again also works:
cordova platform remove ios
cordova platform add ios
Now you can cordova build ios :)
As mentioned by MeV this was a bug.

Setting up a LESS file watcher in PHPStorm 6 using node.js on Windows?

I'm a recent convert to PHPStorm and absolutely loving it. I'm trying to get the 'File Watcher' to work with my LESS code, and I want it to use the lessc command. I have node.js installed and the command 'lessc' works from the windows command prompt, but it doesn't want to work within PHPStorm.
Here is my configuration for the file watcher:
When the file watcher runs, I get this error appear continuously:
An exception occurred while executing watcher 'LESS'. Watcher is
disabled. Fix it.: Cannot run program
"C:\Users\Jason\AppData\Roaming\npm\lessc" (in directory
"F:\Plan2Share_v1\public\css"): CreateProcess error=193, %1 is not a
valid Win32 application
As soon as I enable the watcher again, it somehow disables and throws me the above error again. I'm very new to node.js and PHPStorm. Any direction on where I might be going wrong would be greatly appreciated.
EDIT: Following #josh3736 's direction. I now get his error in the Run console of PHPStorm.
"C:\Program Files\nodejs\node.exe" C:\Users\Jason\AppData\Roaming\npm\lessc F:\Plan2Share_v1\public\css\style.less
C:\Users\Jason\AppData\Roaming\npm\lessc:2 basedir=`dirname "$0"`
^ SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
That error tells us that PHPStorm is calling CreateProcess, which can only start executables. It cannot run scripts/batch files, which is what lessc is. (PHPStorm would have to use ShellExecute for that.)
To work around this limitation, you'll have to specify the Node installation (C:\Program Files\nodejs\node.exe most likely) as the executable, and the arguments should probably be something like C:\Users\Jason\AppData\Roaming\npm\node_modules\less\bin\lessc $FileName$
Change Program: C:\Users\Jason\AppData\Roaming\npm\lessc.cmd
Change Arguments: --no-color $FileName$
Apply
Image: https://dl.dropboxusercontent.com/u/4287697/2014-09-26_11h25_29.png

Node.js: Error: Cannot find module 'stack'

I tried to install howtonode.org on my Osx
cd ~/Sites/
git clone git#github.com:creationix/howtonode.org
My context is the following:
OSx version: 10.7.4
node -v v0.6.15
When I try to run the following command
~/Sites/howtonode.org node server/server.js &
I get the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'stack'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/antoniopierro/Sites/howtonode.org/server/server.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
[1]+ Exit 1 node server/server.js
any ideas?
Try running node ~/Sites/howtonode.org/server/server.js & or go to ~/Sites/howtonode.org/server/ and runnode server
Also, you have not installed the dependencies from package.json.
Go to ~/Sites/howtonode.org/ and type inn npm install. This will install all the dependencies in ~/Sites/howtonode.org/node_modules. You can then run the server.

Resources