node.js fnoc module gives error -- probably something simple - json

I'm sure I'm doing something stupid, but I can't get node-fnoc to work. I have a directory with a simple package.json in it, I have a /config/ directory in that directory with a simple JSON file in it. And, I'm basically just trying to do what they have in their example.
var fnoc = require('fnoc');
fnoc(function(err, configs){
console.log(configs);
});
and this is what I'm getting:
fnoc(function(err, configs){
^
TypeError: object is not a function
at Object.<anonymous> (/opt/backups/readconfig.js:3:1)
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
Any ideas?

The document on github is for version 0.2.2
You need to install fnoc#0.2.2
npm install fnoc#0.2.2
Run your js
node your.js
Output:
{ package:
{ name: 'asdf',
dependencies:
{ express: '*',
jade: '*',
Version is in the changelog file:
https://github.com/jprichardson/node-fnoc/blob/master/CHANGELOG.md

Related

Turn a gedcom file in a json one to create a visualisation 3DJS

I'm trying to transform a gedcom file in json this the following code:
"Installation:
The gedcom package can be added as a dependency to use in your code, or if you'd like to just use the CLI, install it globallly:
npm install -g gedcom"
and please find below the error:
Error: Illegal nesting: transition from 1 to NaN
at /usr/local/lib/node_modules/gedcom/dist/cli.js:2:6625
at e (/usr/local/lib/node_modules/gedcom/dist/cli.js:2:6769)
at /usr/local/lib/node_modules/gedcom/dist/cli.js:2:7434
at Object.<anonymous> (/usr/local/lib/node_modules/gedcom/dist/cli.js:2:7535)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47```
Thank you for your help.
Adrien

Create React App executing tests with jest Unexpected identifier

i am trying execute test with jest in CRA and i keep getting this weird error.
C:\Users\mfonpah\Documents\projects\nexus-web-client\web-
client\node_modules\auth0-js\src\index.js:1
(function (exports, require, module, __filename, __dirname) { import
Authentication from './authentication';
^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Object.require.extensions.(anonymous function) [as .js]
(C:\Users\mfonpah\Documents\projects\nexus-web-client\web-
client\node_modules\babel-register\lib\node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
any ideas on how to fix this?
thanks
If you see this error, your EF6 import statements are not being transpiled. Make sure your babel presets contain "env"
.babelrc and "babel" property in package.json
{
"presets":["env", "react"]
}
Depending on your use case you might also need to add the transform-es2015-modules-amd plugin, more here.

TypeError ... is not a function

I have installed gulp-run-command as follows:
npm install gulp-run-command
I'm running a series of gulp tasks. All the others work, except this one. Here's the task where I'm running gulp-run-command:
var gulp = require('gulp');
var run = require('gulp-run-command');
gulp.task('testTask', run('testString'));
It is directly from the basic usage of gulp-run-command as shown here:
https://www.npmjs.com/package/gulp-run-command#usage
I get the following error as I run gulp:
TypeError: run is not a function
at Object.<anonymous> (c:\mypath\gulp\tasks\common\initLocalJsonSe
rver.js:6:23)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at requireDir (c:\mypath\node_modules\require-dir\index.js:123:33)
at requireDir (c:\mypath\node_modules\require-dir\index.js:76:33)
What's wrong here?
Ok, it worked as I added .default at the end of the line: var run = require('gulp-run-command');
So, like this:
var run = require('gulp-run-command').default

getting error while doing minification of css files with gulp

Please advise i want to minify the .css files of my project with gulp so i have written the below task in my gulp.js file as shown below but still upon execution i am getting the error , please advise how to fix the below error
below is the code that I have written is
var gulp = require('gulp');
var minifyCss = require("gulp-minify-css");
gulp.task('minify-css', function () {
gulp.src('C:\\Softwares\\Spring4MVCAngularJSExample\\target\\Spring4MVCAngularJSExample\\static\\css\\*.css') // path to your file
.pipe(minifyCss())
.pipe(gulp.dest('C:\\Softwares\\Spring4MVCAngularJSExample\\target\\Spring4MVCAngularJSExample\\static\\cssoutput'));
});
below is the error i am getting upon execution
C:\Softwares\Spring4MVCAngularJSExample>gulp minify-css
module.js:471
throw err;
^
Error: Cannot find module 'gulp-minify-css'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Softwares\Spring4MVCAngularJSExample\gulpfile.js:10:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
It appears that it cannot locate the module. Have you run npm install gulp-minify-css --save-dev?
You may want to try re-installing your local packages / dependencies:
rm -rf node_modules/
npm install

IMA.js skeleton install: Cannot find module v8flags

I've tried to install hello world application with this command:
gulp app:hello
I'm getting this error message:
module.js:338
throw err;
^
Error: Cannot find module 'C:\Users\name\AppData\Roaming\npm\node_modules
\gulp\node_modules\v8flags\3.28.73.flags.json'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\name\AppData\Roaming\npm\node_modules
\gulp\bin\gulp.js:25:22)
at Module._compile (module.js:460:26)
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 Function.Module.runMain (module.js:501:10)
Probably you have old version of Gulp.
Try to reinstall with npm install --global gulp.