{"id":1884,"date":"2016-10-19T14:53:40","date_gmt":"2016-10-19T12:53:40","guid":{"rendered":"http:\/\/www.switchbl8.nl\/blog\/?p=1884"},"modified":"2016-10-19T14:53:40","modified_gmt":"2016-10-19T12:53:40","slug":"global-node-js-modules-on-windows","status":"publish","type":"post","link":"https:\/\/www.switchbl8.nl\/blog\/2016\/10\/global-node-js-modules-on-windows\/","title":{"rendered":"Global node.js modules on Windows"},"content":{"rendered":"<p>I&#8217;m using node.js on Windows. Not ideal, I know. Installing node modules globally means something else than you might expect. Globally means &#8220;not in the project folder&#8221;. It does not mean &#8220;for all users on this computer&#8221;, like you&#8217;re used to when installing applications.<\/p>\n<p>Node itself is installed in the &#8220;Program Files&#8221; folder by default. To enable a Windows-like &#8220;global&#8221; install, try using:<br \/>\n<code lang=\"text\"><br \/>\nnpm config set prefix \"%ProgramFiles%\\nodejs\"<br \/>\n<\/code><\/p>\n<p>That way the &#8220;&#8211;global&#8221; directive will install the module in the node folder itself, making it available globally in the node way of thinking and in the Windows way of thinking.<\/p>\n<p>Of course, if you didn&#8217;t install node.js in the default folder, just replace the &#8220;%ProgramFiles%\\nodejs&#8221; with yours.<\/p>\n<p>If for some reason you want things back to what it was, remove the prefix by issuing the following command:<br \/>\n<code lang=\"text\"><br \/>\nnpm config rm prefix<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m using node.js on Windows. Not ideal, I know. Installing node modules globally means something else than you might expect. Globally means &#8220;not in the project folder&#8221;. It does not mean &#8220;for all users on this computer&#8221;, like you&#8217;re used to when installing applications. Node itself is installed in the &#8220;Program Files&#8221; folder by default. <a href='https:\/\/www.switchbl8.nl\/blog\/2016\/10\/global-node-js-modules-on-windows\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[98,81,85],"class_list":["post-1884","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript","tag-tips","tag-windows","category-1-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/comments?post=1884"}],"version-history":[{"count":4,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1884\/revisions"}],"predecessor-version":[{"id":1888,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1884\/revisions\/1888"}],"wp:attachment":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/media?parent=1884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/categories?post=1884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/tags?post=1884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}