{"id":1258,"date":"2021-09-25T10:29:29","date_gmt":"2021-09-25T01:29:29","guid":{"rendered":"https:\/\/www.typea.info\/blog\/?p=1258"},"modified":"2021-09-25T11:27:10","modified_gmt":"2021-09-25T02:27:10","slug":"node_vscode_debug_globalinstall_module_can_not_loaded","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2021\/09\/25\/node_vscode_debug_globalinstall_module_can_not_loaded\/","title":{"rendered":"Node \u3092 Visual Studio Code \u3067\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u3068\u304d\u306b\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044"},"content":{"rendered":"<p>electron \u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f(\u30ed\u30fc\u30ab\u30eb\u306e\u5834\u5408\u306f\u554f\u984c\u306a\u3044)<\/p>\n<pre class=\"prettyprint\">$ npm -g i electron<\/pre>\n<p>electron \u3092\u8d77\u52d5\u3059\u308b\u3068\u52d5\u304f\u306e\u3060\u304c\u3001<\/p>\n<pre class=\"prettyprint\">$ electron .<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Electron_sample_start.png\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2021\/09\/Electron_sample_start.png\" alt=\"Electron sample start\" width=\"291\" height=\"219\" border=\"0\" \/><\/p>\n<p>Visual Studio Code \u306e\u30c7\u30d0\u30c3\u30b0(Node.js)\u3067\u5b9f\u884c\u3059\u308b\u3068\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u306a\u308b\u3002<\/p>\n<pre class=\"prettyprint\">Uncaught Error: Cannot find module \u2018electron\u2019<\/pre>\n<p>\u00a0<\/p>\n<p>\u304a\u305d\u3089\u304f\u30b0\u30ed\u30fc\u30d0\u30eb\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u898b\u3064\u3051\u3089\u308c\u3066\u3044\u306a\u3044\u3002\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u5834\u5408\u306e\u30d1\u30b9\u3092\u78ba\u8a8d\u3002<\/p>\n<p>Mac\u3067\u3001nodebrew \u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b<\/p>\n<pre class=\"prettyprint\"> npm root -g\n\/Users\/hirotoyagi\/.nodebrew\/node\/v16.0.0\/lib\/node_modules<\/pre>\n<p>\u00a0<\/p>\n<p>Node\u304c\u30b0\u30ed\u30fc\u30d0\u30eb\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u63a2\u3057\u306b\u3044\u304f\u30d1\u30b9\u3092\u78ba\u8a8d\u3002<\/p>\n<p>\u4e0a\u8a18\u30d1\u30b9\u306f\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u3002<\/p>\n<pre class=\"prettyprint\">$ node -e \u201cconsole.log(global.module.paths)\u201d\n[\n \u2018\/Users\/hirotoyagi\/node_modules\u2019,\n \u2018\/Users\/node_modules\u2019,\n \u2018\/node_modules\u2019\n]<\/pre>\n<p>\u4e0a\u8a18\u4ee5\u5916\u306b\u3082\u3001NODE_PATH\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30b9\u3092\u63a2\u3057\u306b\u3044\u304f\u3088\u3046\u306a\u306e\u3067\u3001Visual Sutudio Code \u306e launc.json \u306e\u74b0\u5883\u5909\u6570\u306b\u6307\u5b9a\u3059\u308b(env.NODE_PATH\u30a8\u30f3\u30c8\u30ea)<\/p>\n<pre class=\"prettyprint\">\"configurations\": [\n    {\n         :\n        \"env\": {\n            \"NODE_PATH\":\"\/Users\/hirotoyagi\/.nodebrew\/node\/v16.0.0\/lib\/node_modules\",\n        }\n    }\n]\n<\/pre>\n<p><a href=\"https:\/\/www.electronjs.org\/docs\/tutorial\/debugging-vscode\">Electron\u3092\u30c7\u30d0\u30c3\u30b0<\/a>\u3059\u308b\u5834\u5408\u3001\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb(electron)\u304c~.nodebrew\/current\/bin\/electron \u306b\u7f6e\u304b\u308c\u308b\u306e\u3067\u3001runtimeExecutable\u306b\u6307\u5b9a\u3059\u308b<\/p>\n<pre class=\"prettyprint\">{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug Main Process\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"cwd\": \"${workspaceFolder}\",\n      \/\/ \"runtimeExecutable\": \"${workspaceFolder}\/node_modules\/.bin\/electron\",\n      \"runtimeExecutable\": \"\/Users\/hirotoyagi\/.nodebrew\/current\/bin\/electron\",\n      \"args\" : [\".\"],\n      \"outputCapture\": \"std\"\n    }\n  ]\n}\n<\/pre>\n<p><a href=\"https:\/\/www.amazon.co.jp\/Electron%E3%81%A7%E3%81%AF%E3%81%98%E3%82%81%E3%82%8B%E3%82%A2%E3%83%97%E3%83%AA%E9%96%8B%E7%99%BA-%EF%BD%9EJavaScript-HTML-CSS%E3%81%A7%E3%83%87%E3%82%B9%E3%82%AF%E3%83%88%E3%83%83%E3%83%97%E3%82%A2%E3%83%97%E3%83%AA%E3%82%92%E4%BD%9C%E3%82%8D%E3%81%86-%E9%87%8E%E5%8F%A3-ebook\/dp\/B06XTKZS7J?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;dchild=1&amp;keywords=electron&amp;qid=1632533136&amp;sr=8-3&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=8db63ba0aee97599b398afa62a901837&amp;language=ja_JP&amp;ref_=as_li_ss_il\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B06XTKZS7J&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22&amp;language=ja_JP\" border=\"0\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border: none !important; margin: 0px !important;\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;language=ja_JP&amp;l=li2&amp;o=9&amp;a=B06XTKZS7J\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/><\/p>\n<p>\u4ee5\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>electron \u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f(\u30ed\u30fc\u30ab\u30eb\u306e\u5834\u5408\u306f\u554f\u984c\u306a\u3044) $ npm -g i electron electron \u3092\u8d77\u52d5\u3059\u308b\u3068\u52d5\u304f\u306e\u3060\u304c\u3001 $ electron . Visual Studio Co [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1257,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[98,96],"tags":[132,160,155],"class_list":["post-1258","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-js","category-visual-studio-code","tag-mac","tag-node","tag-visual-studio-code"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1258"}],"version-history":[{"count":2,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1258\/revisions"}],"predecessor-version":[{"id":1260,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1258\/revisions\/1260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media\/1257"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}