1import{S as Il,i as kl,s as Rl,k as s,q as a,a as f,l as i,m as r,r as n,h as t,c as u,n as p,b as d,F as o,G as Ro}from"./index.f054af2f.js";function Pl(dl){let c,ae,rt,at,j,nt,dt,Re,Pe,je,_,ft,A,ut,pt,Ae,w,ht,T,mt,ct,Te,E,vt,x,bt,_t,xe,v,wt,ne,Et,yt,de,It,kt,fe,Rt,ge,z,Pt,Le,B,ue,jt,Me,y,At,U,Tt,xt,De,G,gt,Oe,h,Lt,pe,Mt,Dt,he,Ot,Ct,g,Nt,Ht,Ce,K,St,Ne,J,Ft,He,b,Q,qt,me,zt,Bt,V,Ut,L,Gt,Kt,W,Jt,M,Qt,Se,D,fl=`<code class="language-undefined"># adapted from http://elinux.org/Node.js_on_RPi 2wget http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz 3tar -xzf node-v0.12.7.tar.gz # duration ca. 1 min 4cd node-v0.12.7 5./configure # duration ca. 1 min</code>`,Fe,X,Vt,qe,m,ce,ve,Wt,Xt,Y,be,Yt,Zt,$t,Z,_e,eo,to,oo,$,we,lo,so,ze,ee,io,Be,O,ul='<code class="language-undefined">/usr/include/linux/sysinfo.h:8:2: error: unknown type name '__kernel_long_t'`</code>',Ue,I,ro,C,ao,no,Ge,N,pl=`<code class="language-undefined">#ifndef __kernel_long_t 6typedef long __kernel_long_t; 7typedef unsigned long __kernel_ulong_t; 8#endif 9</code>`,Ke,te,fo,Je,H,hl='<code class="language-undefined">
9 #define SI_LOAD_SHIFT 16struct sysinfo {...</code>',Qe,oe,uo,Ve,S,ml='<code class="language-undefined">/bin/sh: 1: cannot create /home/pi/node-v0.12.7/out/Release/.deps//home/pi/node-v0.12.7/out/Release/obj.target/libuv/deps/uv/src/unix/linux-core.o.d: Permission denied</code>',We,le,po,Xe,k,Ee,ye,ho,mo,Ie,ke,co,Ye,se,vo,Ze,F,cl=`<code class="language-undefined">/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" 10Illegal instruction 11make[1]: *** [/home/pi/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132 12make[1]: Leaving directory `/home/pi/node-v0.12.7/out' 13make: *** [node] Error 2</code>`,$e,ie,bo;return{c(){c=s("p"),ae=s("strong"),rt=a("EDIT"),at=a(" The issue concerning the compilation of npm for ARM seems to have been fixed, which would outdate this post. The latest builds should be available at "),j=s("a"),nt=a("https://nodejs.org/dist/"),dt=a(". For RPi 1 look for the builds with âarmv6lâ, for RPi2B âarmv7lâ, and for RPi3 I assume you would need âarm64â."),Re=f(),Pe=s("hr"),je=f(),_=s("p"),ft=a("Although itâs relatively easy to install "),A=s("a"),ut=a("Node.js"),pt=a(" on a Raspberry Pi, getting npm to work is a bit more challenging."),Ae=f(),w=s("p"),ht=a("It seems there is "),T=s("a"),mt=a("an issue with compiling npm"),ct=a(", at least for ARM. As long as this remains unfixed, there is no npm with the node 0.12.x ARM installation."),Te=f(),E=s("p"),vt=a("A very simple workaround is to copy the node_modules from another system and to run the packages (e.g. "),x=s("a"),bt=a("bunyan"),_t=a(", which is supposed to be installed globally) with node. Since installing (globally or not) is not possible, but node is installed, I will call it directly from the node_modules that I copied from another machine."),xe=f(),v=s("p"),wt=a("So instead of using "),ne=s("code"),Et=a("npm start"),yt=a(" configured in package.json as "),de=s("code"),It=a("node app.js | bunyan"),kt=a(" I would do "),fe=s("code"),Rt=a("node app.js | node node_modules/bunyan/bin/bunyan"),ge=f(),z=s("p"),Pt=a("Or if I would like to read the log file afterwards:"),Le=f(),B=s("p"),ue=s("code"),jt=a("node node_modules/bunyan/bin/bunyan -o short error.log"),Me=f(),y=s("p"),At=a("This would also work for other systems where npm canât be installed or if npm canât be used to install packages. Iâve used this on a system behind a corporate proxy, although Iâve found "),U=s("a"),Tt=a("a better way"),xt=a(" by now."),De=f(),G=s("h1"),gt=a("Node on RPi"),Oe=f(),h=s("p"),Lt=a("Keep in mind that this still requires Node.js to be installed. For a Raspberry Pi running Raspbmc itâs possible to use "),pe=s("em"),Mt=a("apt-get"),Dt=a(" to install Node, but it wonât be a recent version. Instead, I use the ARM build "),he=s("em"),Ot=a("node_latest_armhf.deb"),Ct=a(" from "),g=s("a"),Nt=a("node-arm"),Ht=a("."),Ce=f(),K=s("h1"),St=a("Compiling Node on RPi"),Ne=f(),J=s("p"),Ft=a("Iâve also tried compiling Node from source on the Raspberry Pi (model B). It should not be very difficult, but it failed in my case, probably because of the issue with npm, mentioned before. To be complete, I will list my steps."),He=f(),b=s("ul"),Q=s("li"),qt=a("I had already installed gcc earlier with "),me=s("code"),zt=a("sudo apt-get install build-essential"),Bt=f(),V=s("li"),Ut=a("I looked up the latest version in "),L=s("a"),Gt=a("http://nodejs.org/dist/"),Kt=f(),W=s("li"),Jt=a("At 11-7-2015 this was "),M=s("a"),Qt=a("http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz"),Se=f(),D=s("pre"),Fe=f(),X=s("p"),Vt=a("Here I would really recommend to start a screen session, because compiling takes ca. 2 hours."),qe=f(),m=s("ul"),ce=s("li"),ve=s("code"),Wt=a("sudo apt-get install screen"),Xt=f(),Y=s("li"),be=s("code"),Yt=a("screen"),Zt=a(" start a session"),$t=f(),Z=s("li"),_e=s("code"),eo=a("ctrl + a, d"),to=a(" detach session"),oo=f(),$=s("li"),we=s("code"),lo=a("screen -dRR"),so=a(" reattach to any session running"),ze=f(),ee=s("p"),io=a("My first attempt to run make ended with this error:"),Be=f(),O=s("pre"),Ue=f(),I=s("p"),ro=a("From "),C=s("a"),ao=a("this thread"),no=a(" I found the solution to add these lines:"),Ge=f(),N=s("pre"),Ke=f(),te=s("p"),fo=a("to the file /usr/include/linux/sysinfo.h, before the lines:"),Je=f(),H=s("pre"),Qe=f(),oe=s("p"),uo=a("The second attempt to run make failed with this error:"),Ve=f(),S=s("pre"),We=f(),le=s("p"),po=a("So in the end I ran clean and make as root:"),Xe=f(),k=s("ul"),Ee=s("li"),ye=s("code"),ho=a("sudo make clean"),mo=f(),Ie=s("li"),ke=s("c
13ode"),co=a("sudo make"),Ye=f(),se=s("p"),vo=a("after some hours it fails with:"),Ze=f(),F=s("pre"),$e=f(),ie=s("p"),bo=a("This is either the compile issue as described in the beginning of this article, or yet again another issue. Since I found out about the compile issue at this point Iâve stopped experimenting and resorted to the quick workaround."),this.h()},l(e){c=i(e,"P",{});var l=r(c);ae=i(l,"STRONG",{});var Po=r(ae);rt=n(Po,"EDIT"),Po.forEach(t),at=n(l," The issue concerning the compilation of npm for ARM seems to have been fixed, which would outdate this post. The latest builds should be available at "),j=i(l,"A",{href:!0,rel:!0});var jo=r(j);nt=n(jo,"https://nodejs.org/dist/"),jo.forEach(t),dt=n(l,". For RPi 1 look for the builds with âarmv6lâ, for RPi2B âarmv7lâ, and for RPi3 I assume you would need âarm64â."),l.forEach(t),Re=u(e),Pe=i(e,"HR",{}),je=u(e),_=i(e,"P",{});var et=r(_);ft=n(et,"Although itâs relatively easy to install "),A=i(et,"A",{href:!0,rel:!0});var Ao=r(A);ut=n(Ao,"Node.js"),Ao.forEach(t),pt=n(et," on a Raspberry Pi, getting npm to work is a bit more challenging."),et.forEach(t),Ae=u(e),w=i(e,"P",{});var tt=r(w);ht=n(tt,"It seems there is "),T=i(tt,"A",{href:!0,rel:!0});var To=r(T);mt=n(To,"an issue with compiling npm"),To.forEach(t),ct=n(tt,", at least for ARM. As long as this remains unfixed, there is no npm with the node 0.12.x ARM installation."),tt.forEach(t),Te=u(e),E=i(e,"P",{});var ot=r(E);vt=n(ot,"A very simple workaround is to copy the node_modules from another system and to run the packages (e.g. "),x=i(ot,"A",{href:!0,rel:!0});var xo=r(x);bt=n(xo,"bunyan"),xo.forEach(t),_t=n(ot,", which is supposed to be installed globally) with node. Since installing (globally or not) is not possible, but node is installed, I will call it directly from the node_modules that I copied from another machine."),ot.forEach(t),xe=u(e),v=i(e,"P",{});var q=r(v);wt=n(q,"So instead of using "),ne=i(q,"CODE",{});var go=r(ne);Et=n(go,"npm start"),go.forEach(t),yt=n(q," configured in package.json as "),de=i(q,"CODE",{});var Lo=r(de);It=n(Lo,"node app.js | bunyan"),Lo.forEach(t),kt=n(q," I would do "),fe=i(q,"CODE",{});var Mo=r(fe);Rt=n(Mo,"node app.js | node node_modules/bunyan/bin/bunyan"),Mo.forEach(t),q.forEach(t),ge=u(e),z=i(e,"P",{});var Do=r(z);Pt=n(Do,"Or if I would like to read the log file afterwards:"),Do.forEach(t),Le=u(e),B=i(e,"P",{});var Oo=r(B);ue=i(Oo,"CODE",{});var Co=r(ue);jt=n(Co,"node node_modules/bunyan/bin/bunyan -o short error.log"),Co.forEach(t),Oo.forEach(t),Me=u(e),y=i(e,"P",{});var lt=r(y);At=n(lt,"This would also work for other systems where npm canât be installed or if npm canât be used to install packages. Iâve used this on a system behind a corporate proxy, although Iâve found "),U=i(lt,"A",{href:!0});var No=r(U);Tt=n(No,"a better way"),No.forEach(t),xt=n(lt," by now."),lt.forEach(t),De=u(e),G=i(e,"H1",{});var Ho=r(G);
13gt=n(Ho,"Node on RPi"),Ho.forEach(t),Oe=u(e),h=i(e,"P",{});var R=r(h);Lt=n(R,"Keep in mind that this still requires Node.js to be installed. For a Raspberry Pi running Raspbmc itâs possible to use "),pe=i(R,"EM",{});var So=r(pe);Mt=n(So,"apt-get"),So.forEach(t),Dt=n(R," to install Node, but it wonât be a recent version. Instead, I use the ARM build "),he=i(R,"EM",{});var Fo=r(he);Ot=n(Fo,"node_latest_armhf.deb"),Fo.forEach(t),Ct=n(R," from "),g=i(R,"A",{href:!0,rel:!0});var qo=r(g);Nt=n(qo,"node-arm"),qo.forEach(t),Ht=n(R,"."),R.forEach(t),Ce=u(e),K=i(e,"H1",{});var zo=r(K);St=n(zo,"Compiling Node on RPi"),zo.forEach(t),Ne=u(e),J=i(e,"P",{});var Bo=r(J);Ft=n(Bo,"Iâve also tried compiling Node from source on the Raspberry Pi (model B). It should not be very difficult, but it failed in my case, probably because of the issue with npm, mentioned before. To be complete, I will list my steps."),Bo.forEach(t),He=u(e),b=i(e,"UL",{});var re=r(b);Q=i(re,"LI",{});var _o=r(Q);qt=n(_o,"I had already installed gcc earlier with "),me=i(_o,"CODE",{});var Uo=r(me);zt=n(Uo,"sudo apt-get install build-essential"),Uo.forEach(t),_o.forEach(t),Bt=u(re),V=i(re,"LI",{});var wo=r(V);Ut=n(wo,"I looked up the latest version in "),L=i(wo,"A",{href:!0,rel:!0});var Go=r(L);Gt=n(Go,"http://nodejs.org/dist/"),Go.forEach(t),wo.forEach(t),Kt=u(re),W=i(re,"LI",{});var Eo=r(W);Jt=n(Eo,"At 11-7-2015 this was "),M=i(Eo,"A",{href:!0,rel:!0});var Ko=r(M);Qt=n(Ko,"http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz"),Ko.forEach(t),Eo.forEach(t),re.forEach(t),Se=u(e),D=i(e,"PRE",{class:!0});var vl=r(D);vl.forEach(t),Fe=u(e),X=i(e,"P",{});var Jo=r(X);Vt=n(Jo,"Here I would really recommend to start a screen session, because compiling takes ca. 2 hours."),Jo.forEach(t),qe=u(e),m=i(e,"UL",{});var P=r(m);ce=i(P,"LI",{});var Qo=r(ce);ve=i(Qo,"CODE",{});var Vo=r(ve);Wt=n(Vo,"sudo apt-get install screen"),Vo.forEach(t),Qo.forEach(t),Xt=u(P),Y=i(P,"LI",{});var yo=r(Y);be=i(yo,"CODE",{});var Wo=r(be);Yt=n(Wo,"screen"),Wo.forEach(t),Zt=n(yo," start a session"),yo.forEach(t),$t=u(P),Z=i(P,"LI",{});var Io=r(Z);_e=i(Io,"CODE",{});var Xo=r(_e);eo=n(Xo,"ctrl + a, d"),Xo.forEach(t),to=n(Io," detach session"),Io.forEach(t),oo=u(P),$=i(P,"LI",{});var ko=r($);we=i(ko,"CODE",{});var Yo=r(we);lo=n(Yo,"screen -dRR"),Yo.forEach(t),so=n(ko," reattach to any session running"),ko.forEach(t),P.forEach(t),ze=u(e),ee=i(e,"P",{});var Zo=r(ee);io=n(Zo,"My first attempt to run make ended with this error:"),Zo.forEach(t),Be=u(e),O=i(e,"PRE",{class:!0});var bl=r(O);bl.forEach(t),Ue=u(e),I=i(e,"P",{});var st=r(I);ro=n(st,"From "),C=i(st,"A",{href:!0,rel:!0});var $o=r(C);ao=n($o,"this thread"),$o.forEach(t),no=n(st," I found the solution to add these lines:"),st.forEach(t),Ge=u(e),N=i(e,"PRE",{class:!0});var _l=r(N);_l.forEach(t),Ke=u(e),te=i(e,"P",{});var el=r(te);fo=n(el,"to the file /usr/include/linux/sysinfo.h, before the lines:"),el.forEach(t),Je=u(e),H=i(e,"PRE",{class:!0});var wl=r(H);wl.forEach(t),Qe=u(e),oe=i(e,"P",{});var tl=r(oe);uo=n(tl,"The second attempt to run make failed with this error:"),tl.forEach(t),Ve=u(e),S=i(e,"PRE",{class:!0});var El=r(S);El.forEach(t),We=u(e),le=i(e,"P",{});var ol=r(le);po=n(ol,"So in the end I ran clean and make as root:"),ol.forEach(t),Xe=u(e),k=i(e,"UL",{});var it=r(k);Ee=i(it,"LI",{});var ll=r(Ee);ye=i(ll,"CODE",{});var sl=r(ye);ho=n(sl,"sudo make clean"),sl.forEach(t),ll.forEach(t),mo=u(it),Ie=i(it,"LI",{});var il=r(Ie);ke=i(il,"CODE",{});var rl=r(ke);co=n(rl,"sudo make"),rl.forEach(t),il.forEach(t),it.forEach(t),Ye=u(e),se=i(e,"P",{});var al=r(se);vo=n(al,"after some hours it fails with:"),al.forEach(t),Ze=u(e),F=i(e,"PRE",{class:!0});var yl=r(F);yl.forEach(t),$e=u(e),ie=i(e,"P",{});var nl=r(ie);bo=n(nl,"This is either the compile issue as described in the beginning of this article, or yet again another issue. Since I found out about the compile issue at this point Iâve stopped experimenting and resorted to the quick workaround."),nl.forEach(t),this.h()},h(){p(j,"href","https://nodejs.org/dist/"),p(j,"rel","nofollow"),p(A,"href","http://nodejs.org"),p(A,"rel","nofollow"),p(T,"href","http://redandwhite.herokuapp.com/#/post/5516eba439156a0e00cad4f6"),p(T,"rel","nofollow"),p(x,"href","https://github.com/trentm/node-bunyan"),p(x,"rel","nofollow"),p(U,"href","../npm-without-internet"),p(g,"href","http://node-arm.herokuapp.com"),p(g,"rel","nofollow"),p(L,"href","http://nodejs.org/dist/"),p(L,"rel","nofollow"),p(M,"href","http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz"),p(M,"rel","nofollow"),p(D,"class","language-undefined"),p(O,"class","language-undefined"),p(C,"href","http://raspberrypi.stackexchange.com/questions/8566/peerguardian-moblock-installation-on-raspbmc"),p(C,"rel","nofollow"),p(N,"class","language-undefined"),p(H,"class","language-undefined"),p(S,"class","language-undefined"),p(F,"class","language-undefined")},m(e,l){d(e,c,l),o(c,ae),o(ae,rt),o(c,at),o(c,j),o(j,nt),o(c,dt),d(e,Re,l),d(e,Pe,l),d(e,je,l),d(e,_,l),o(_,ft),o(_,A),o(A,ut),o(_,pt),d(e,Ae,l),d(e,w,l),o(w,ht),o(w,T),o(T,mt),o(w,ct),d(e,Te,l),d(e,E,l),o(E,vt),o(E,x),o(x,bt),o(E,_t),d(e,xe,l),d(e,v,l),o(v,wt),o(v,ne),o(ne,Et),o(v,yt),o(v,de),o(de,It),o(v,kt),o(v,fe),o(fe,Rt),d(e,ge,l),d(e,z,l),o(z,Pt),d(e,Le,l),d(e,B,l),o(B,ue),o(ue,jt),d(e,Me,l),d(e,y,l),o(y,At),o(y,U),o(U,Tt),o(y,xt),d(e,De,l),d(e,G,l),o(G,gt),d(e,Oe,l),d(e,h,l),o(h,Lt),o(h,pe),o(pe,Mt),o(h,Dt),o(h,he),o(he,Ot),o(h,Ct),o(h,g),o(g,Nt),o(h,Ht),d(e,Ce,l),d(e,K,l),o(K,St),d(e,Ne,l),d(e,J,l),o(J,Ft),d(e,He,l),d(e,b,l),o(b,Q),o(Q,qt),o(Q,me),o(me,zt),o(b,Bt),o(b,V),o(V,Ut),o(V,L),o(L,Gt),o(b,Kt),o(b,W),o(W,Jt),o(W,M),o(M,Qt),d(e,Se,l),d(e,D,l),D.innerHTML=fl,d(e,Fe,l),d(e,X,l),o(X,Vt),d(e,qe,l),d(e,m,l),o(m,ce),o(ce,ve),o(ve,Wt),o(m,Xt),o(m,Y),o(Y,be),o(be,Yt),o(Y,Zt),o(m,$t),o(m,Z),o(Z,_e),o(_e,eo),o(Z,to),o(m,oo),o(m,$),o($,we),o(we,lo),o($,so),d(e,ze,l),d(e,ee,l),o(ee,io),d(e,Be,l),d(e,O,l),O.innerHTML=ul,d(e,Ue,l),d(e,I,l),o(I,ro),o(I,C),o(C,ao),o(I,no),d(e,Ge,l),d(e,N,l),N.innerHTML=pl,d(e,Ke,l),d(e,te,l),o(te,fo),d(e,Je,l),d(e,H,l),H.innerHTML=hl,d(e,Qe,l),d(e,oe,l),o(oe,uo),d(e,Ve,l),d(e,S,l),S.innerHTML=ml,d(e,We,l),d(e,le,l),o(le,po),d(e,Xe,l),d(e,k,l),o(k,Ee),o(Ee,ye),o(ye,ho),o(k,mo),o(k,Ie),o(Ie,ke),o(ke,co),d(e,Ye,l),d(e,se,l),o(se,vo),d(e,Ze,l),d(e,F,l),F.innerHTML=cl,d(e,$e,l),d(e,ie,l),o(ie,bo)},p:Ro,i:Ro,o:Ro,d(e){e&&t(c),e&&t(Re),e&&t(Pe),e&&t(je),e&&t(_),e&&t(Ae),e&&t(w),e&&t(Te),e&&t(E),e&&t(xe),e&&t(v),e&&t(ge),e&&t(z),e&&t(Le),e&&t(B),e&&t(Me),e&&t(y),e&&t(De),e&&t(G),e&&t(Oe),e&&t(h),e&&t(Ce),e&&t(K),e&&t(Ne),e&&t(J),e&&t(He),e&&t(b),e&&t(Se),e&&t(D),e&&t(Fe),e&&t(X),e&&t(qe),e&&t(m),e&&t(ze),e&&t(ee),e&&t(Be),e&&t(O),e&&t(Ue),e&&t(I),e&&t(Ge),e&&t(N),e&&t(Ke),e&&t(te),e&&t(Je),e&&t(H),e&&t(Qe),e&&t(oe),e&&t(Ve),e&&t(S),e&&t(We),e&&t(le),e&&t(Xe),e&&t(k),e&&t(Ye),e&&t(se),e&&t(Ze),e&&t(F),e&&t($e),e&&t(ie)}}}const Al={title:"npm workaround",cover:"https://picsum.photos/800/600?image=3",date:"12-07-2015",category:"webdevelopment",tags:["webdevelopment"],preview:"EDIT The issue concerning the compilation of npm for ARM seems to have been fixed, which would outdate this post. The latest builds should be available at https://nodejs.org/dist/. For RPi 1 look for the builds with âarmv6lâ, for RPi2B âarmv7lâ, and...",previewHtml:'<p><strong>EDIT</strong> The issue concerning the compilation of npm for ARM seems to have been fixed, which would outdate this post. The latest builds should be available at <a href="https://nodejs.org/dist/" rel="nofollow">https://nodejs.org/dist/</a>. For RPi 1 look for the builds with âarmv6lâ, for RPi2B âarmv7lâ, and ...</p>'};class Tl extends Il{constructor(c){super(),kl(this,c,null,Pl,Rl,{})}}export{Tl as default,Al as metadata};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.