أريد تشغيل D3 من Cakefile
-
15-11-2019 - |
سؤال
أود تنفيذ بعض رمز D3 من سطر الأوامر.في البداية، جربت شيئا مثل: giveacodicetagpre.
ولكن هذا لم ينجح.حصلت على أخطاء مثل هذا: giveacodicetagpre.
هكذا ... أحسب أن هذا الاستثناء كان يخبرني أنني بحاجة إلى تنفيذ D3 داخل متصفح.حاولت هذا بطرق مختلفة.في الأساس، اعتقدت إذا أطلقت فقط phantomjs ربما أكون قادرا على القيام بما أردت القيام به.هنا كان بلدي cakefile: giveacodicetagpre.
عندما أذهب إلى هذا الطريق، أذهب دائما إلى الحصول على استثناءات مثل هذا: giveacodicetagpre.
ماذا أنا أخطأ ؟؟
بفضل mbostock حصلت على العمل التالي:
package.jsy: giveacodicetagpre.
بلدي cakefile: giveacodicetagpre.
المحلول
See D3's package.json. More specifically, the file you want to require when running inside Node or similar environments is index.js rather than d3.v2.js; this file contains some special patches that make D3 compatible with the require
operator.
To try it out for yourself, cd
to the d3 repository, run node
to create an interactive shell, and then say
var d3 = require("./");
Or, if you're in your own project folder, if you've installed D3 into node_modules/d3 via npm (npm install d3
), you can say:
var d3 = require("d3");