Chart.js zoom plugin: Unexpected identifier error in console - chart.js

I am trying to test chart.js zoom plugin example (from official examples folder) locally. Example file name is zoom.html
I changed scripts paths to local paths in the example code:
<script src="Chart.bundle.js"></script>
<script src="hammer.min.js"></script>
<script src="chartjs-plugin-zoom.js"></script>
All scripts are latest versions:
Chart.js: 2.7.3
Hammer.js: 2.0.8
chartjs-plugin-zoom: does not have version number, but latest downloaded from github
The zoom does not work and I see the error in console:
Uncaught SyntaxError: Unexpected identifier
in line 3 of chartjs-plugin-zoom.js
so it seems like
import Chart from 'chart.js';
line in the plugin code works wrong. Or maybe I am doing wrong something.
The same error happened when I tried other locations of the libraries.

You can run the examples by doing:
git clone https://github.com/chartjs/chartjs-plugin-zoom.git
cd chartjs-plugin-zoom
npm install
gulp build

Related

include sympy library into chaquo

include sympy python packages into Chaquopy:
I started with the example python provided by Chaquopy available at github (https://github.com/chaquo/chaquopy) for Android studio 3.0.1.
Than I created 2 wheel files from the sympy source () files, based on python 3.6.3, see the below files that wheel generated:
"mpmath-1.0.0-py3-none-any.whl"
"sympy-1.1.1-py3-none-any.whl"
I tried to install the above files into the build.gradle of the demo example from 1., for testing purposes I tried some of there own wheel files (that process succeeded), but could not install my own wheel files.
I am fairly certain that the local wheel files that I generated are placed in the proper directory, because if I change the directory in the gradle file it complains that it cannot find the file.
I included the wheel files in the build.gradle(Module:app) file as follows:
python {
// Enable and edit the following line if "python" is not on your PATH.
// buildPython "C:/Python27/python.exe"
version "3.6.3"
// Android UI demo
pip {
install "Pygments==2.2.0" // Also used in Java API demo
}
pip {
install "wheels/mpmath-1.0.0-py3-none-any.whl"
// install "wheels/sympy-1.1.1-py3-none-any.whl"
// install "numpy==1.9.2"
// install "numpy==1.14.0"
}
When created the build gradle generates the following error:
sympy-1.1.1-py3-none-any.whl is not a supported wheel on this platform.
Exit status 1
:app:generatePy2DebugPythonRequirements FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:generatePy2DebugPythonRequirements'.
Process 'command 'python'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
7 actionable tasks: 1 executed, 6 up-to-date
Does anyone have an idea what could be wrong?
sympy and mpmath have now been added to the Chaquopy wheel repository (https://github.com/chaquo/chaquopy/issues/20), so you don't need to build your own anymore.
Did some further investigation and did see that I somehow compiled for Py2, while my wheel files where version 3 changing this resulted in a correct executable.
It did run into a different issue, while the mpmath module could be imported into the interactive python console (part of the demo app), the sympy module gave an error:
ModuleNotFoundError: no module named 'distutils'
Let me know if anyone ran into a similar problem!

what is an error "Error: Unexpected token '}' in JSON at position 1923" in ionic 2

I am using Ionic-2 framework. When I install any native plugin in my application it throws the following error in command line.
Error: Unexpected token '}' in JSON at position 1923
I am not getting what is causing this error, now I'm unable to install any plugin.
I had a similar problem:
Error: Unexpected token / in JSON at position 1057
when I issued the command:
ionic plugin add phonegap-plugin-barcodescanner
The reason was I made a mistake by trying to comment a line of "plugins/fetch.json" by "//". Cerntainly, a json file couldn't be commented this way. However, Ionic 2 didn't tell you which file had the problem.
So, please check the json file Ionic might touch during the process, e.g. package.json & plugins/fetch.json
Make sure all the {} pair are matched.
I run into this problem when trying to execute cordova build --release android
Execute cordova plugin rm cordova-plugin-console to solve it.

Importing chart.js to aurelia causes page errors after bunldling

In a project using the aurelia framework I installed chart.js v2.0 beta using:
jspm install npm:chart.js
I import the library by using:
import Chart from 'chart.js';
When application is unbundled I get no errors. If I bundle the application the page loads and displays the graph, but I get 78 errors of missing javascript files like this:
GET http://localhost:9000/core/core.js 404 (Not Found) # system.src.js:4597
As far as I can think it searches for these files (which are part of the chart.js library), in the base directory (which is localhost:9000 as I run gulp watch).
Does anyone know what I am doing wrong?
most likely you need to install chart.js with a "global" override:
jspm install npm:chartjs -o "{format: 'global'}"
But, actually, your best option is to use aurelia-chart, which is based on chart.js 2.x :)

Ember error: path "vendor/loader.js/loader.js" did not match any files

Building off: Ember-cli - Bower not installing properly
I just upgraded from ember-cli 0.0.40 to 0.1.2 and when I run the ember server I also have an issue with moment. 48 JSHint Errors of Bad option: 'moment'.
After JSHint is done letting me have it, I did a bad path error for loader.js:
Path or pattern "vendor/loader.js/loader.js" did not match any files
Error: Path or pattern "vendor/loader.js/loader.js" did not match any files
at Object.multiGlob (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-kitchen-sink-helpers/index.js:221:13)
at /home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/index.js:62:32
at $$$internal$$tryCatch (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
Before upgrading to ember-cli#0.1.2 I was getting an includes error for ember-cli-simple-auth. I did do ember g ember-cli-simple-auth and that's nifty, but the above error persists.
Make sure to follow the steps on the releases page to have a solid upgrade.
Specifically in your case, this is likely caused by an app.import in your Brocfile.js. One of the big changes was that bower components were moved to /bower_components instead of /vendor. That error says that something is trying to import loader.js from the vendor directory.
It could be caused by you trying to import it in your Brocfile or due to ember-cli not being updated properly in your node_modules folder. If it still references the old version, it will try to import from vendor/ instead of bower_components. To fix that, just rm -rf node_modules and npm install to reinstall the modules.
The releases page mentions how to clear your npm cache to reinstall everything if you are still having trouble.

Debowerifying Ember causes error

I have installed ember as a bower component:
bower install ember
The debowerify transform is applied like so:
var debowerify = require('debowerify');
browserify().
.transform(debowerify)
.require('./bower_components/ember/ember.js')
.bundle()
.pipe(source('vendor.js'))
.pipe(gulp.dest('./build'));
When I run the above as a gulp task, it shows me the error:
```
[07:38:56] Starting 'browserify'...
[07:38:56] Running 'bundle'...
events.js:72
throw er; // Unhandled 'error' event
^
Error: Cannot find module '../package.json' from 'app_root/bower_components/ember'
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:43:25
at load (app_root/node_modules/browserify/node_modules/resolve/lib/async.js:61:43)
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:67:22
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:21:47
at Object.oncomplete (fs.js:107:15)
```
On inspecting the ember.js file from the bower_components/ember directory, saw the following code:
var packageVersion = require('../package.json').version;
I am not sure how to resolve this issue and make debowerify play nice with Ember. I have created a repo that demonstrates the problem: https://github.com/saravanak/ember-debowerify