1
我試圖預渲染使用NPM與node.js的
dc.js但圖表直流預渲染圖時,我在我的代碼包括DC,它拋出的錯誤,我在node.js的一個nwebie,試圖尋找對於答案沒有運氣,可能是它應該是一個版本錯誤我知道,jsdom版本> 1沒有createWindow(); methord但改變的版本,並呼籲NPM安裝和更新力的工作要麼..任何幫助大大appriciated,在此先感謝
我的package.json
{
"name": "binode",
"version": "1.0.0",
"description": "binode testing",
"main": "index.js",
"scripts": {
"start": "node index"
},
"author": "abc",
"license": "MIT",
"dependencies": {
"body-parser": "^1.13.3",
"d3": "^3.5.6",
"dc": "^1.7.3",
"express": "^4.13.3",
"jsdom": "^1.5.0"
}
}
錯誤:
/learn/nodeSample/biNode/node_modules/dc/globals.js:2
window = global.window = document.createWindow();
^
TypeError: undefined is not a function
at Object.<anonymous> (/Volumes/Official/learn/nodeSample/biNode/node_modules/dc/globals.js:2:39)
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 Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Volumes/Official/learn/nodeSample/biNode/node_modules/dc/index.js:8:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.7
npm ERR! npm v2.14.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node index'.
npm ERR! This is most likely a problem with the binode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index
npm ERR! You can get their info via:
npm ERR! npm owner ls binode
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Volumes/Official/learn/nodeSample/biNode/npm-debug.log
NPM-的debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 info [email protected] Failed to exec start script
10 verbose stack Error: [email protected] start: `node index`
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
10 verbose stack at EventEmitter.emit (events.js:110:17)
10 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack at ChildProcess.emit (events.js:110:17)
10 verbose stack at maybeClose (child_process.js:1015:16)
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid [email protected]
12 verbose cwd /Volumes/Official/learn/nodeSample/biNode
13 error Darwin 14.5.0
14 error argv "node" "/usr/local/bin/npm" "start"
15 error node v0.12.7
16 error npm v2.14.1
17 error code ELIFECYCLE
18 error [email protected] start: `node index`
18 error Exit status 1
19 error Failed at the [email protected] start script 'node index'.
19 error This is most likely a problem with the binode package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error node index
19 error You can get their info via:
19 error npm owner ls binode
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
我簡單的js文件:
var express = require('express');
var app = express();
var d3 = require('d3');
var dc = require('dc');
var crossfilter = require('crossfiler');
var jsdom = require('jsdom');
global.d3 = d3;
var port = 2000;
app.listen(port,function(){
console.log("app listing port "+port)
});
我纔剛剛開頭本身就扔錯誤
通過在dc.js github有一個疑問沒有globals.js文件,但我得到這在我的node_module/dc /我的npm版本是2.14.1 – mithra