![](/img/trans.png)
[英]Trying to execute command from Nodejs (exec) throw error but works in terminal
[英]Throw error whenever attempting to use geoproject command in terminal
每當我嘗試使用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)
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。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.