windows下如何使用Nide?
发布于 12 年前 作者 coderhaoxin 7193 次浏览 最后一次编辑是 8 年前
10 回复

其实nide官网说的很清楚了 安装:

step 1:
npm install -g nide  //能不能装上看人品

step 2:
cd to_your_project_path 

setp 3:
nide init 

能不能装上还真看人品

这个人品肯定也可以分析解决的吧

根据上面的步骤安装完后,开始修改文件假设nide是安装在:

C:\Documents and Settings\Administrator\Application Data\npm\node_modules\nide

打开nide下的main.js 修改以下几行:

var checkForDependencies = function(callback) {
     exec('which npm', function(err, stdout, stderr) {
         if (err) {
             console.error('Could not find `npm` command. Is npm installed?')
             process.exit(-1)
         } else {
            callback()
        }
   })
}

改成:

var checkForDependencies = function(callback) {
    callback()
}

打开 nide/server/server.js 注释掉一下几行:

server.listen(port, host, function() {
      staticServer.listen(port+1, host, function() {
         // if run as root, downgrade to the owner of this file
          if (process.getuid() === 0) {
             if(downgrade == true){
                  require('fs').stat(__filename, function(err, stats) {
                  if (err) return console.log(err)
                  process.setuid(stats.uid);
                  });
              }
         }
    });
});

好了,可以运行 nide init 或者 nide 了 打开http://localhost:8123

@jankuo 根据楼主方法改过以后还是打不开,提示连接不到服务器

nide init以后显示’could not find ‘npm’ command 是不是下载的nide-master包要放到哪个目录下,初学者求赐教

装一个git bash。然后在git bash中运行(minigw环境). 我试过,成功!

回到顶部