美文网首页
node-webkit js 安装问题

node-webkit js 安装问题

作者: 寒冬飞雪 | 来源:发表于2016-11-04 12:34 被阅读0次

    在安装node-webkit遇到以下问题


    1. npm install -g nw 无法安装成功

    描述:

    npm install -g nw 执行到 node scripts/install.js 时卡住,之后报错,无法安装成功。

    原因:

    由于需要从github下载一个超大的sdk,因此经常无法下载成功。

    解决办法:

    a、中断安装过程(ctrl+c),打开js文件 nw/scripts/install.js,找到代码:

    switch (process.platform) 
    {
        case 'win32':
          url = urlBase + version + '/nwjs' + buildTypeSuffix + '-v' + version + '-win-' + process.arch +'.zip'; 
          break; 
       case 'darwin':
          url = urlBase + version + '/nwjs' + buildTypeSuffix + '-v' + version + '-osx-' + process.arch + '.zip';
          break;
        case 'linux':
          url = urlBase + version + '/nwjs' + buildTypeSuffix + '-v' + version + '-linux-' + process.arch + '.tar.gz';
          break;
    }
    

    在其后加入代码

    console.log(url); 
    

    执行 node xxxx/scripts/install.js 得到下载地址。将文件下载到本地
    之后修改install.js文件

    url = "file://本地zip文件的路径"
    

    之后执行命令 node xxxx/scripts/install.js 完成后续安装。


    2. Error: spawn EACCES错误

    描述:

    在安装完成后,执行nw时提示错误信息 :

    Error: spawn EACCES
    at exports._errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:380:9)
    at run (/usr/local/lib/node_modules/nw/bin/nw:31:12)
    at Object. (/usr/local/lib/node_modules/nw/bin/nw:53:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    

    原因:

    执行文件的访问权限问题。

    解决办法:

    只需要将nw以及刚安装的sdk设置为普通用户可读写的权限即可。

    chmod -R 777  路径

    相关文章

      网友评论

          本文标题:node-webkit js 安装问题

          本文链接:https://www.haomeiwen.com/subject/euziuttx.html