igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

compile.js error #45

Closed mylady closed 9 years ago

mylady commented 9 years ago

hi, i use serialport and xml2json which both load native module, and i found example in the reposity like this

var enclose = require("../../").exec;
try {
  require.resolve("serialport");
} catch(error) {
  console.log("Failed to require('serialport')");
  console.log("Please run 'npm install' here");
  process.exit(1);
}

enclose(flags);

but i got a error cant find module ("../../") i'm a newbie to nodejs and i dont quite understand require('"../../") means

igorklopov commented 9 years ago

require("../../") means to find package.json in that directory, take main and require it. You can replace it with require('enclose') if you installed enclose globally

mylady commented 9 years ago

i installed enclose globally and require('enclose') cause error then i install it locally it works but for the executable it crash with this: (this is the example serialport)

undefined:0

Error: Cannot find module '/Users/MyLady/saints/saints3.0/security_detector/sample/nodemodules/serialport/build/serialport/v1.7.4/Release/node-v14-darwin-ia32/serialport.node' at Error (native) at O () at h () at Object.Math.Enclose.+/+t+h+e+b+o+x+/+U+s+e+r+s+/+M+y+L+a+d+y+/+s+a+i+n+t+s+/+s+a+i+n+t+s+3+.+0+/+s+e+c+u+r+i+t+y++d+e+t+e+c+t+o+r+/+s+a+m+p+l+e+/+n+o+d+e++m+o+d+u+l+e+s+/+s+e+r+i+a+l+p+o+r+t+/+s+e+r+i+a+l+p+o+r+t+.+j+s.dev () at u () at O () at h () at Object.Math.Enclose.+/+t+h+e+b+o+x+/+U+s+e+r+s+/+M+y+L+a+d+y+/+s+a+i+n+t+s+/+s+a+i+n+t+s+3+.+0+/+s+e+c+u+r+i+t+y++d+e+t+e+c+t+o+r+/+s+a+m+p+l+e+/+i+n+d+e+x+.+j+s.dev () at u () at

mylady commented 9 years ago

the node_modules folder is right besides executable file

igorklopov commented 9 years ago

Please find serialport.node file. Where is it?

mylady commented 9 years ago

oh sorry,my mistake my os is 64bit and i didn't add --x64 flag now it works

thx very much for your patience!