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.
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.
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
I have a .tmlanguage file that works fine in Sublime Text 2 and highlights everything as needed. But I'm unable to convert it to the Ace highlight rules.
Or rather I convert it but I get errors in ace.js main file.
What I do:
1) clone ace repository
2) navigate to ace/tool and execute this command in command prompt: npm install
3) then execute this command: node tmlanguage.js <path_to_tmlanguage_file> and get:
parseString is deprecated. Please, use parseStringSync instead.
Two files are created in ace\lib\ace\mode directory.
4) navigate to ace main folder by executing cd ..
5) execute node Makefile.dryice.js full and get:
module.js:340
throw err;
^
Error: Cannot find module 'dryice'
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> (E:\myPath\ace\Makefile.
dryice.js:38:12)
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)
6) have to execute npm install in /ace main folder and then again call node Makefile.dryice.js full to build the project.
Now built files are copied to ace/build folder.
Suppose my html file and /ace folder are in the same folder. Here is a chunk from html:
<script src="ace/build/src-noconflict/ace.js"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/slbeclipse");
</script>
In the ace\build\src-noconflict folder I have mode-slbeclipse.js file.
7) open this html file in chrome (or other browsers) and get (in console tab):
Uncaught TypeError: object is not a function ace.js:8018
Here is the 8018th line:
this.moveCursorTo(row, column);
8) set a breakpoint -> first time it's hit this.moveCursorTo is undefined but the error is not thrown, the error thrown second time.
9) change that line to:
if(this.moveCursorTo)
{
this.moveCursorTo(row, column);
}
Than I get error on line 8564: Uncaught TypeError: object is not a function:
this.getTokenizer = function() {
if (!this.$tokenizer) {
this.$highlightRules = new this.HighlightRules();
// here the exception occures
this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
}
return this.$tokenizer;
};
10) Tried to debug and edit ace.js file multiple times - errors in other places occure.
Sublime Text 2 uses .tmlanguage properly and everything is highlighted. So, I think, the problem should be in ace or (I hope) it's my fault and I'm missing something obvious.
The converter isn't fully automatic, it just extracts regexps from tmlanguage file, and resulting file needs to be fixed manually. (see here)
I'd suggest to ask for help on that issue.
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