yo polymer building error - polymer

I have just updated my Polymer development tools and I get some errors, although everything was working fine before. Here is what I get when trying 'yo polymer' in the console :
/usr/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:444
this.env.sharedFs.on('change', writeFiles);
^
TypeError: Object # has no method 'on'
at run (/usr/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:444:21)
at Environment.run (/usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:330:20)
at /usr/lib/node_modules/yo/lib/cli.js:91:9
at Environment.resolver.lookup (/usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/resolver.js:50:12)
at init (/usr/lib/node_modules/yo/lib/cli.js:66:7)
at pre (/usr/lib/node_modules/yo/lib/cli.js:53:3)
at Object. (/usr/lib/node_modules/yo/lib/cli.js:155:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Or when I type 'yo' in the console and choose 'polymer' :
/usr/lib/node_modules/yo/node_modules/inquirer/node_modules/rx/dist/rx.all.js:9379
throw e;
^
TypeError: Object # has no method 'on'
at run (/usr/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:444:21)
at Environment.run (/usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:330:20)
at module.exports (/usr/lib/node_modules/yo/lib/routes/run.js:20:11)
at Router.navigate (/usr/lib/node_modules/yo/lib/router.js:36:30)
at PromptUI.completed (/usr/lib/node_modules/yo/lib/routes/home.js:76:20)
at PromptUI.onCompletion (/usr/lib/node_modules/yo/node_modules/inquirer/lib/ui/prompt.js:69:10)
at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/usr/lib/node_modules/yo/node_modules/inquirer/node_modules/rx/dist/rx.all.js:1965:12)
at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/lib/node_modules/yo/node_modules/inquirer/node_modules/rx/dist/rx.all.js:1902:14)
at AutoDetachObserverPrototype.completed (/usr/lib/node_modules/yo/node_modules/inquirer/node_modules/rx/dist/rx.all.js:9397:23)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted >(/usr/lib/node_modules/yo/node_modules/inquirer/node_modules/rx/dist/rx.all.js:1902:14)
Any idea on what when wrong with the updates (no error thrown).
Thanks for reading and all the best.
PS : I am running on
Fedora 20
npm 2.5.1
yo 1.4.5
generator-polymer 0.7.0
gem 2.1.11
sass 3.4.12
compass 1.0.3

Update yo (npm install -g yo). I had the same problem.

Related

Unexpected token in kafkajs code for a kafka consumer application

Nodejs version : 4.4.7
NPM version: 2.15.8
I am running the following code, which is literally copied from the following URL
https://kafka.js.org/docs/getting-started
const { Kafka } = require('kafkajs')
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['kafka1:9092', 'kafka2:9092']
})
The above code is saved in "apps.js" file under a "simpleapp" folder. In addition to that I have installed the following
npm install kafkajs
When I run the app.js file I get the following error
/Users/nick/Documents/nodeprojects/simpleapp/apps.js:1
(function (exports, require, module, __filename, __dirname) { const { Kafka } = require('kafkajs')
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
What is the issue?
Version 4.4.7 of NodeJS is very old, and isn't even supported anymore. KafkaJS follows the same support schedule as NodeJS itself, so the oldest currently supported version is 8.

Trying to complie sass with elixir and gulp but I when i try gup in terminal, get this error:

I'm using laravel elixir and gulp to compile my sass files. but when i write gulp in termial I get this error.
fs.js:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (/home/user/Videos/projetct-folder/project/node_modules/natives/index.js:143:24)
at Object.req [as require] (/home/user/Videos/projetct-folder/projetct/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/home/user/Videos/projetct-folder/projetct/node_modules/laravel-elixir-livereload/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
Node version: 12.4.0
gulp CLI version: 2.2.0
gulp Local version: 4.0.2
gulpfile.js:
var elixir = require('laravel-elixir');
require('laravel-elixir-livereload');
elixir.config.assetsPath = 'themes/project/assets/';
elixir.config.publicPath = 'themes/project/assets/compiled/';
elixir(function(mix){
mix.sass('agency.scss');
mix.scripts([
'jqBootstrapValidation.js',
'agency.js',
'contact_me.js',
'recherche.js'
]);
mix.livereload([
'themes/project/assets/compiled/css/agency.css',
'themes/project/**/*.htm',
'themes/project/assets/compiled/js/*.js'
])
})
Judging by this bug report for Gulp, it's possible that one of the dependencies is using Gulp 3
one of the packages in your project is likely to be requiring gulp 3. If you inspect your package-lock.json which contains the list of installed packages, you should be able to sort it out.
It specifically mentions the graceful-fs module.

How to gulp a task without "primordials is not defined" and "Assertion error" errors

Today I tried to gulp a task inside my web application project folder on Tomcat8. I got a source code for a web app and I am trying to customize it.
I know there are several explanations about the errors I am going to show you, but it's always about switching from V3.9.1 to V4.0.2 and from V4.0.2 to V3.9.1 my gulp version. And I get a different problem on both :D
V3.9.1 Gulp:
C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master>gulp
fs.js:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\node_modules\natives\index.js:143:24)
at Object.req [as require] (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\node_modules\natives\index.js:55:10)
at Object.<anonymous> (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master>gulp -v
CLI version: 2.2.0
Local version: 3.9.1
V4.0.2 Gulp
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\node_modules\undertaker\lib\set-task.js:10:3)
at Gulp.task (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\node_modules\undertaker\lib\task.js:13:8)
at Object.<anonymous> (C:\Users\Administrator\Documents\Source code for Apache\pa-downtime-uApp-master\gulpfile.js:18:6)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
at execute (C:\Users\Administrator\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:36:18) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
Task script
I was also wondering why in my task scripts there is no task name … I would like to try my commands with a task name after "gulp". When I check on other task files there is always a task name:
'use strict';
const gulp = require('gulp'),
war = require('gulp-war'),
zip = require('gulp-zip'),`enter code here`
path = require('path');
module.exports = function (gulp) {
return function () {
return gulp.src('dist/bundled/**')
.pipe(war({
welcome: 'index.html',
displayName: 'downtime-app',
}))
.pipe(zip('downtime-app.war'))
.pipe(gulp.dest('dist/'));
};
};
Sorry if I am saying any blunders, I am a total beginner and didn't even know what was HTML 1 week ago … :)
If you are using gulp 3.. and node 12+ => it will give the error.
Uninstall it and use node 11.. with gulp 3..
Ok, when I replace all my tasks by a single and basic one, the gulp 4.0.2V works well:
C:\Users\Administrator\Documents\Source code test\Source code test\Source code for Apache\pa-downtime-uApp-master>gulp bacon
[14:46:12] Using gulpfile ~\Documents\Source code test\Source code test\Source code for Apache\pa-downtime-uApp-master\gulpfile.js
[14:46:12] Starting 'bacon'...
miam miam
[14:46:12] The following tasks did not complete: bacon
[14:46:12] Did you forget to signal async completion?
So I think the problem remains in the dependencies between the several tasks or, in the bonds between the gulpfile.js and the task folder that was made by my web application creator.
Finally I found the task names in the gulpfile.js but even using them doesn't work.

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.

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

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