尝试在终端中使用geoproject命令时引发错误

时间:2019-01-15 22:22:38

标签: node.js d3.js data-visualization

每次尝试使用geoproject命令时,我都会不断遇到相同的错误。

我已下载了最新版本的node和D3。

错误消息:

Parkers-MacBook-Pro-2:proj parkerbarton$ geoproject
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'resolve'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/d3-geo-projection/bin/resolve.js:2:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

1 个答案:

答案 0 :(得分:0)

tldr;只需重新安装即可获得d3-geo-projection的新版本。

npm install -g d3-geo-projection

这里有一个问题:https://github.com/d3/d3-geo-projection/issues/161

对于拉取请求,此问题已得到解决,但尚未被拉入。您可以等待修复,或者在此期间,您可以将'require'添加到{global-install-location} /node_modules/d3-geo-projection/package.json

中的同一位置

https://github.com/d3/d3-geo-projection/pull/162/commits/43105df62b784f0645cb3d4cb0b0fa98c8924c87

更新:它是2.6版,只需重新安装d3-geo-projection。

相关问题