---
title: "MochiWeb在linux下安装注意问题"
author: "dxm1986"
date: "2011-02-17T11:47:27Z"
tags: []
categories: ["编程语言"]
slug: "mochiweb-linux"
draft: false
lastmod: "2011-02-17T11:47:27Z"
id: 908560
url: "https://wolfdream.iteye.com/blog/908560"
---

## MochiWeb在linux下安装注意问题

 ![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif "此博文包含图片")(2010-06-07 16:04:30)

[![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)转载](http://blog.sina.com.cn/s/blog_53ec65170100imfd.html)

转自：

标签： 

### [it](http://uni.sina.com.cn/c.php?t=blog&k=it&ts=bpost&stype=tag)

[http://blog.sina.com.cn/s/blog\_53ec65170100imfd.html](http://blog.sina.com.cn/s/blog_53ec65170100imfd.html)

最近因为项目需要研究了一下MochiWeb,在linux下安装MochiWeb碰到了一些问题，记录如下：

1、make源代码不成功  
  我下载的是MochiWeb上最新版本，make报错，mochiweb.app的错误，调了半天没找到问题，svn看MochiWeb代码log,

![MochiWeb在linux下安装注意问题](http://static3.photo.sina.com.cn/bmiddle/53ec6517g886c8205c6a2&690)

设置svn版本为157重新下载make,搞定。

2、./start-dev.sh无法执行问题  
  按照[实战MochiWeb](http://erlang-china.org/start/mochiweb_intro.html)实战MochiWeb方法安装完后执行./start-dev.sh，返回“没有权限”，解决chmod +x start-dev.sh,将start-dev.sh属性设置为可执行  
  执行./start-dev.sh，返回“没有找到文件或者目录”，原因MochiWeb代码我是从win下svn下载然后上传linux的，new\_mochiwe.erl文件格式在win下被转换了，具体原因如下：  
  如果我们是在windows上编辑的shell文件，上传到linux上，执行的时候可能会出现一些莫名  
其妙的问题，其原因是在windows上编辑的文件每一行的结尾会有一个回车换行符（十六进制代码  
为0d0a），而在linux上的文件换行符为0a，0d会莫名其妙的变成一个^M非可见字符。而这个字符  
会被shell文件读到，影响命令的正常执行。  
    所以，当我们的linux上的shell文件出现奇怪的问题时我们不妨使用命令cat -A filename来  
看一下文件中行结尾是不是有^M这个东西，如果有需要把它处理掉。处理办法有如下两个：  
    1、使用命令cat filename | col &gt; newfile  注意这个命令不支持汉字，如果filename文件  
中有汉字的话转换将出现问题。即使汉字是出现在注释中也不行。  
    2、使用dos2unix filename 命令转换。  
  执行dos2unix start-dev.sh，搞定问题。

3、start-dev.sh服务没有启动  
  执行start-dev.sh后，访问http://localhost:8000，无法访问，重新编译安装openssl,搞定  
  终于看到了期待已久的“MochiWeb running. ”，细节很重要。