node.js shell environment variable conflict with cakephp - shell

I have set cakes environment path in my .profile file, but it seems the
> cake
has taken by node.js coffeescript, and outputs the following error
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cakefile not found in /Users/Devric
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:96:11
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:95:32
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:95:32
at Object.run (/opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:46:19)
at Object.<anonymous> (/opt/local/lib/node_modules/coffee-script/bin/cake:7:38)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)

Fixed the issue, by renaming the cake shell for cakephp to cakes, so that it won't conflict with the coffeescript cake file.

Related

How to fix Unexpected token { when running npx cypress?

I run
npx cypress
And get
Unexpected token {
Maybe there is a way to get more details, tried:
DEBUG=cypress:server:socket-base npx cypress
But still same error and no more info. First it was working, I think I did not change anything and one day it started giving this error. Maybe I changed something not knowing that I did.
Maybe it has to do something with versions?
npx -v
6.14.5
Update:
Executed different way
$ ./node_modules/.bin/cypress
/home/darius/Private/Projects/vop-live-automated-checks/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (/home/darius/Private/Projects/vop-live-automated-checks/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
Maybe this is same but full error?
If it suddenly happened, you might have switched out of bash terminal. double check.
Just deleted node_modules and ran
npm install
and now works.

Adding WebSocket to Webserver

I'm trying to add websocket to my webserver by simply following this guide using a Beaglebone:
https://www.w3schools.com/nodejs/nodejs_raspberrypi_webserver_websocket.asp
However, I'm getting this error:
tugbars#beaglebone:~$ sudo node webserver1.js
/home/tugbars/node_modules/ws/lib/websocket.js:347
...options
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/tugbars/node_modules/ws/index.js:3:19)
I think the problem is at
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js"></script>
this part but I couldn't figure out how to solve it.Thanks for help.
Extra information. I have downloaded socket.io as sudo. When i type npm list socket.io, I'm getting the version of the installed socket.io. Node is also at it's last version.
You almost certainly have an outdated version of Node that doesn't have support for the spread operator (foo = { ...options }) or for destructuring (const { x, ...options } = foo). Update to a newer version of Node (12.14.1 is the latest stable release).
Also, you mention “downloading socket.io as sudo”, possibly referring to installing the node module, but you also shared an HTML script tag showing a Cloudflare hosted version. You might want to make sure you understand how you're loading that library before proceeding.

Rxjs Mocha tests will not run on WebStorm

I have been trying to get the spec tests running from the rxjs repository on the WebStorm IDE.
https://github.com/ReactiveX/rxjs.git
The issue is that I can run the tests using the included script, and manually through the command line but configuring WebStorm is not working.
Below is the error message that I am getting most frequently. I have included the default opts file for Mocha, and below is the result.
ReferenceError: asDiagram is not defined
at Suite.<anonymous> (/Users/test/Desktop/Test/rxjs/spec/Observable-spec.ts:636:3)
at Object.create (/Users/test/Desktop/Test/rxjs/node_modules/mocha/lib/interfaces/common.js:112:19)
at context.describe.context.context (/Users/test/Desktop/Test/rxjs/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Object.<anonymous> (/Users/test/Desktop/Test/rxjs/spec/Observable-spec.ts:635:1)
at Module._compile (module.js:652:30)
at Module.m._compile (/Users/test/Desktop/Test/rxjs/node_modules/ts-node/src/index.ts:430:23)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/test/Desktop/Test/rxjs/node_modules/ts-node/src/index.ts:433:12)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
the problem occurs because Webstorm is passing --ui bdd to mocha, overwriting your custom ui specified in spec/support/default.opts. To work out the issue, you have to change User interface: option in Mocha run configuration from default (bdd) to your custom one (spec/helpers/testScheduler-ui.ts) - field is editable, you can type/paste the value. Configuration that works fine for me:

SyntaxError: Unexpected token =>

When I ran the gulp command from the root of the project, a problem turned out.
elixir((mix) => {
SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at execute (D:\nodejs\node_global\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js:24:18)
at Liftoff.handleArguments (D:\nodejs\node_global\node_modules\gulp-cli\index.js:149:63)
at Liftoff.<anonymous> (D:\nodejs\node_global\node_modules\gulp-cli\node_modules\liftoff\index.js:198:16)
The gulpfile is from a Laravel Project, here it is https://github.com/rappasoft/laravel-5-boilerplate/blob/master/gulpfile.js .
I had searched the problem above over stack and other network station, but couldn't find any useful advise.
Btw, it was run on Windows, you can get it from the details code above.
If somebody can help, I will be very appreciate . THX !
Arrow function are new JavaScript (ES6), so maybe your node and npm version is old and you should upgrade it. Use this official installer.
https://nodejs.org/dist/v6.9.2/node-v6.9.2-x64.msi

How can I run script files by their shortcuts in Windows?

Tried naive way with a standard Windows shortcut file and with a cmd.exe, failed like this:
D:\...>node tty-checker.js.lnk
D:\...\tty-checker.js.lnk:1
(function (exports, require, module, __filename, __dirname) { L
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
Maybe you can suggest a way?
Amazing if there is a general method working not only for .js, but for any other source code file type too.

Resources