how do I tell cake where to look for coffee? - windows-7

Setting up the express coffee app that twilson63 built. It seems that cake can't find coffee, but they both are ok with which. Is there something else I need to do here? Here's my steps:
jcollum#DEVELOPER01 ~/dev/express-coffee-master
$ which coffee
/c/Users/jcollum/AppData/Roaming/npm/node_modules/coffee-script/bin/coffee
OK coffee is there.
jcollum#DEVELOPER01 ~/dev/express-coffee-master
$ which cake
/c/Users/jcollum/AppData/Roaming/npm/node_modules/coffee-script/bin/cake
And so is cake.
jcollum#DEVELOPER01 ~/dev/express-coffee-master
$ cake
Cakefile defines the following tasks:
cake docs # Generate annotated source code with Docco
cake build
cake spec # Run Mocha tests
cake test # Run Mocha tests
cake dev # start dev env
cake debug # start debug env
cake scaffold # scaffold model/controller/test
-n, --name name of model to `scaffold`
Cake found a cakefile locally.
jcollum#DEVELOPER01 ~/dev/express-coffee-master
$ cake dev
c:\Users\jcollum\dev\express-coffee-master\node_modules\which\which.js:83
throw new Error("not found: "+cmd)
^
Error: not found: coffee
at Function.whichSync [as sync] (c:\Users\jcollum\dev\express-coffee-master\node_modules\which\which.js:83:9)
at Object.options [as action] (c:\Users\jcollum\dev\express-coffee-master\Cakefile:121:17)
at helpers.extend.invoke (c:\Users\jcollum\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\cake.js:44:26)
at Object.exports.run (c:\Users\jcollum\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\cake.js:69:21)
at Object.<anonymous> (c:\Users\jcollum\AppData\Roaming\npm\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)
Bzzzzttt! Nope. I suspect this is an issue with Windows 7 and node not playing all that nicely together.

Seems the answer was to make sure I had a NODE_PATH in my env:
export NODE_PATH=/c/Users/jcollum/AppData/Roaming/npm:/c/Users/jcollum/AppData/Roaming/npm/node_modules
Either that, or adding the node_modules to my PATH in .bash_profile.
Got the idea here: https://github.com/replit/jsrepl/issues/56

Related

How do I build a modernizr with my custom list of features?

With the "old" modernizr I used something like
https://modernizr.com/download?-flexbox-flexboxlegacy-flexboxtweener-flexwrap-fullscreen-geolocation-video-webp-setclasses-dontmin
in order to build it with my needed features.
Apparently it doesn't work any more, at least it doesn't use the current release. The docs say that I must install modernizr with npm and then use bin/modernizr, which want the features to detect as a comma separated list of the -f parameter, and the options as a comma separated list of the -o paramenter.
I'm seeing a list of options and features in https://github.com/Modernizr/Modernizr/blob/HEAD/lib/config-all.json, but the features don't work: I'm trying
$ ./bin/modernizr -f "img/webp"
and I get
/home/user/git/Modernizr/bin/modernizr:137
throw new Error('invalid key value name - ' + prop);
^
Error: invalid key value name - img/webp
at /home/paolo/git/Modernizr/bin/modernizr:137:17
at Array.map (<anonymous>)
at find (/home/paolo/git/Modernizr/bin/modernizr:122:8)
at Object.<anonymous> (/home/paolo/git/Modernizr/bin/modernizr:145:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
I'm getting the same error with a comma separated list of various options.
What am I missing?

nexus generate supabase url not found (env variable)

Prisma Nexus generate does not find environment variable
I have import 'dotenv/config' at the root of my Apollo Server set. So I can develop fine. However, when I try to run ts-node --transpile-only apollo/schema I get the following error.
This tells me that dotenv isn't running on generate. Is there a configuration for this somewhere?
/{user-path}/node_modules/#supabase/supabase-js/src/SupabaseClient.ts:62
if (!supabaseUrl) throw new Error('supabaseUrl is required.')
^
Error: supabaseUrl is required.
at new SupabaseClient (/{user-path}/node_modules/#supabase/supabase-js/src/SupabaseClient.ts:62:29)
at createClient (/{user-path}/node_modules/#supabase/supabase-js/src/index.ts:21:10)
at /{user-path}/apollo/src/supabase-client.ts:9:22
at Object.<anonymous> (/{user-path}/apollo/src/supabase-client.ts:10:3)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Module.m._compile (/{user-path}/node_modules/ts-node/src/index.ts:1371:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/{user-path}/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
error Command failed with exit code 1.
I put import 'dotenv/config' at the root of the apollo server so running the server was fine. However, when I go to build the schema directly I don't get my env vars. So I also put the dotenv/config in my schema.ts. It's not a great solution since on server startup I config twice. But it works for now. Would appreciate to hear a better solution if anyone has one.

Cypress parallel run with Browserstack

I'm trying to run Cypress BDD test suites with Browserstack but i kept getting this error
CYPRESS_RUN_FAILEDCypress failed to run. Hide stack trace [-]
The plugins file is missing or invalid.
Your pluginsFile is set to .\cypress\plugins\index.js, but either
the file is missing, it contains a syntax error, or threw an error
when required. The pluginsFile must be a .js, .ts, or .coffee
file.
Or you might have renamed the extension of your pluginsFile. If
that's the case, restart the test runner.
Please fix this, or set pluginsFile to false if a plugins file is
not necessary for your project.
Error: Cannot find module 'cypress-cucumber-preprocessor' Require
stack:
.\cypress\plugins\index.js
\cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js
\cypress_package\4.12.1\app\packages\server\lib\plugins\child\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
at Module._load (internal/modules/cjs/loader.js:691:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (.\cypress\plugins\index.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at module.exports (\cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js:208:15)
cypress run process exited with code 1 cypress run failed, exiting
with code: 1
After following the answer suggestion, it seems it cannot read my stepDef and Page class files;
enter image description here
From the stack trace, I see:
Cannot find module 'cypress-cucumber-preprocessor' Require stack
Looks like you're missing the dependency.
Cypress execution on BrowserStack requires you to explicitly mention the npm packages required by the test in the browserstack.json file.
Here's the documentation link: https://www.browserstack.com/docs/automate/cypress/npm-packages

Compile error when using the new mmlight with a preprocessing script

I've moved from the now deprecated jquery.mmenu (available at http://mmenu.frebsite.nl/) to mmlight (https://mmenujs.com/).
Same author, different version of the script, with the latter being more modern and short in size between the other things.
While using the new version in conjunction with a static site generator that has a pre-processing routine to compress Javascript I got an error that I was able to pin down to the line that contains the =>
document.addEventListener("DOMContentLoaded", () => {
Regrettably the error from the verbose is not helpful when it says:
SyntaxError: Unexpected token: punc ())
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:48
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (internal/modules/cjs/loader.js:738:30)
Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
Module.load (internal/modules/cjs/loader.js:630:32)
tryModuleLoad (internal/modules/cjs/loader.js:570:12)
Function.Module._load (internal/modules/cjs/loader.js:562:3)
Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
Does anybody have an idea on how to forward?
Is there any chance to rewrite the routine as a custom prototype or similar?
So apparently the issue is the new ES6 and Uglifier that doesn't support it in full yet as stated here https://github.com/lautis/uglifier
The workaround is to activate the compressor as per their recommendation.

Code coverage for Mocha in Windows 7

I am trying to do code coverage for mocha using istanbul which I have installed globally:
I do this as suggested here
E:\Do\learn_mocha>istanbul cover _mocha -- -R spec
C:\Users\Vamsi\AppData\Roaming\npm\_mocha.CMD:1
(function (exports, require, module, __filename, __dirname) { #IF EXIST "%~dp0
^
No coverage information was collected, exit without writing coverage information
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.Module._extensions..js (C:\Users\Vamsi\AppData\Roaming\npm\node_mo
dules\istanbul\lib\hook.js:102:13)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at runFn (C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\comma
nd\common\run-with-cover.js:114:16)
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\command\comm
on\run-with-cover.js:232:17
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:56:16
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:35:9
This command also throws the same error as above:
E:\Do\learn_mocha>istanbul cover --hook-run-in-context _mocha -- -R spec
I was told by a github issue that I had to add a path to mocha from node_modules,so I did this:
E:\Do\learn_mocha>istanbul cover C:\Users\Vamsi\AppData\Roaming\npm\mocha -- -R
spec
C:\Users\Vamsi\AppData\Roaming\npm\mocha:2
basedir=`dirname "$0"`
^
No coverage information was collected, exit without writing coverage information
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.Module._extensions..js (C:\Users\Vamsi\AppData\Roaming\npm\node_mo
dules\istanbul\lib\hook.js:102:13)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at runFn (C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\comma
nd\common\run-with-cover.js:114:16)
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\command\comm
on\run-with-cover.js:232:17
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:56:16
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:35:9
I am using Windows 7 as my OS
My test looks like this:
var assert = require("assert"); // core module
var C = require('../cash.js'); // our module
describe('Cash Register', function(){
describe('Module C', function(){
it('should have a getChange Method', function(){
assert.equal(typeof C, 'object');
assert.equal(typeof C.getChange, 'function');
})
it('getChange(210,300) should equal [50,20,20]',function(){
assert.deepEqual(C.getChange(210,300),[50,20,20]);
})
it('getChange(486,1000) should equal [500,10,2,2]',function(){
assert.deepEqual(C.getChange(486,1000),[500,10,2,2]);
})
it('getChange(1487,10000) should equal [5000,2000,1000,500,10,2,1]',function(){
assert.deepEqual(C.getChange(1487,10000),[5000,2000,1000,500,10,2,1]);
})
})
})
This worked for me:
I have both mocha and istanbul installed locally (no -g on the npm install).
I was running
*./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha*
and this came up with the error you were seeing above. I have changed this to look in the explicit local folder for mocha
*./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha*
and now everything is working great.
Please note I'm running my setup under gitbash on windows 7
Try this one, it should work.
istanbul cover %APPDATA%/npm/node_modules/mocha/bin/_mocha -- -R spec
As per this comment in github, in windows the batch commands are not being resolved inside javascript. Hence causing the issue.
As per the suggestion, you can directly pass the javascript function for mocha to istanbul. Here is how you can do it
Type npm ls -g --depth=0
Copy the first line of the output.
it should be C:\Users\<YourUserName>\AppData\Roaming\npm
Type istanbul cover C:\Users\<YourUserName>\AppData\Roaming\npm\node_modules\mocha\bin\_mocha test\folder
So here instead of passing the _mocha(windows command), the javascript from your global mocha installation is being passed. This is exactly what, happening for the local installation of mocha in the previous answer.
Try this command:
istanbul cover C:\\Users\\username\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\_mocha
^
Insert Your username here
Where username = Your username
Try:
istanbul cover %NODE_HOME%\node_modules\mocha\bin_mocha -- -R spec --recursive test

Resources