CoffeeScript and Cake - macos

I installed CoffeeScript on my machine with npm install -g coffee-script I get the following message when I check cake version:
$ coffee -v
CoffeeScript version 1.3.3
[~]
$ cake -v
path.existsSync is now called `fs.existsSync`.
/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108
throw new Error("Cakefile not found in " + (process.cwd()));
^
Error: Cakefile not found in /Users/Phil
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108:11)
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
at Object.exports.run (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:49:19)
at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/coffee-script/bin/cake:7:38)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
Does anyone know how can I fix this?

There are two issues here.
The first is a known issue which causes:
path.existsSync is now called `fs.existsSync`
You can find out more about the issue here:
https://github.com/jashkenas/coffee-script/pull/2411
As stated in the pull request, it should be fixed in the coffee-script master branch. So you can download the latest source from GitHub and it should resolve the issue for you.
Otherwise, try installing an older version of node:
http://nodejs.org/dist/v0.6.6/
The second issue which is addressed in other answers, is the need for a Cakefile in the directory that you are running the cake command in.

Cakefile should be exists in directory where you call cake

I had similar issue in cakephp3. Above solution didn't work. I was trying to bake plugin from the command line.
cake bake Plugin PageManager
After receiving above error, I changed my command to following and it worked like a charm .
./cake bake plugin PageManager
Hope it will help to someone who had similar issues as mine.

Related

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.

Error when run substrate-front-end-template$ yarn install

I have been following the instruction to Install the Front-end template , error when I run substrate-front-end-template$ yarn install.The error is following:
Error: Cannot find module 'worker_threads'
## Heading ##at Function.Module._resolveFilename (internal/modules cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /home/erichuang2005/substrate-node-template/substrate-front-end-template/.yarn/releases/yarn-berry.cjs:289:2658
I'm not sure about your exact error message but I also had a problem with yarn install which was solved by using a different version of node. I had a problem with version 17. Version 16 worked for me.

Ionic 3 Cannot find module "rxjs/operators/share"

I'm using Ionic 3 to build an mobile application and everything is working fine, but when I add #ngx-translate, I got this error and I didn't find any solution for this issues
ionic (Ionic CLI) : 3.12.0
Uncaught Error: Cannot find module "rxjs/operators/share"
at Object.<anonymous> (vendor.js:159023)
at Object.<anonymous> (core.es5.js:3855)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at Object.397 (main.ts:5)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at Object.392 (main.js:852)
at __webpack_require__ (bootstrap 4cdf06f8badf4bef7b37:54)
at webpackJsonpCallback (bootstrap 4cdf06f8badf4bef7b37:25)
at main.js:1
For me helps change the version of #ngx-translate/core to version: "7.2.2"
I've compare with working example of github repo of ngx-translate
https://github.com/ngx-translate/core/blob/master/examples/ionic/package.json
Change the version of #ngx-translate/core in you package.json
to "#ngx-translate/core": "7.2.2",
and run npm update
I faced the same problem just few days back. What you need to do is uninstall the current #ngx-translate/core which version 9.0.2 by running this command npm uninstall #ngx-translate/core --save this will remove the module and also update your package.json file. now install the module again and specify the version number like this npm install #ngx-translate/core#8.0.0 --save.
This is most likely caused by your rxjs version. Please update it to the latest stable version and you shouldn't see this issue anymore.

Modify Kibana Source Code for Pie Charts

We are Exploring possibilities to extend and modify Kibana. I am trying to customize the existing Pie Chart functionality by forking kibana and then adding some consoles and eventually add customizations in Pie_chart.js in src/cli/public/vislib/visualizations. When I do ./kibana from bin in my local branch of kibana it gives me an error
/Users/schhatre/kibanSourceRepo/kibana/src/optimize/babel_options.js:4
let cloneDeep = require('lodash').cloneDeep;
^^^^^^^^^
SyntaxError: Unexpected identifier
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/schhatre/kibanSourceRepo/kibana/src/cli/index.js:3:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
My forked Kibana is https://github.com/schhatre/kibana. I also removed 'Use Strict' since it was giving me Keyword 'Word' errors earlier when I run ./kibana
Eventually I would like to start kibana by modifying kibana.yml with my IP and see my consoles and eventually move on to customize the Pie Charts.
I was successfully able to start Kibana and implement some plugins (Since plugins can be added in src/plugins and don't need Kibana Source code Changes) from downloaded zip but not from the github forked/cloned master branch's bin location.
Any help would be appreciated.I even went to an older 4.4 Version our company is on and tried to run ./kiban from /bin. Still no luck..
Swaraj
It seems that your NodeJs version does not support ES2015 syntax. Make sure that you are using the proper version. To get the required NodeJs version:
cat .node-version
(your version is 4.4.4 on your repository)
Install this version with NVM (install NVM first if you don't have it):
nvm install v4.4.4
Use the version you just installed :
nvm use v4.4.4
Start Kibana:
npm start

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.

Resources