【问题标题】:Buiding javascript with Makefile使用 Makefile 构建 JavaScript
【发布时间】:2015-10-30 05:43:07
【问题描述】:

我已经克隆了一个nodejs项目,该项目包含一个Makefile

SRC = $(wildcard lib/**/*.js)
CSS = $(wildcard lib/**/*.css)
HTML = $(wildcard lib/**/*.html)
COMPONENTJSON = $(wildcard lib/*/component.json)
TEMPLATES = $(HTML:.html=.js)

build: components $(SRC) $(CSS) $(TEMPLATES)
    @echo building
    @component build

components: component.json $(COMPONENTJSON)
    @echo installing
    @component install

%.js: %.html
    @echo converting
    @component convert $<

minify:
    @component build --use component-minify

clean:
    @echo cleaning
    rm -fr build components $(TEMPLATES)

.PHONY: clean minify

之前我不知道 make 可以用来构建 javascript,当我运行 make 时出现错误

installing
make: component: Command not found
make: *** [components] Error 127

我的问题是,
1.是使用unix系统提供的默认make,还是使用其他某种节点库?
2.如果是同一个系统默认,为什么会报错?

link to the example project

【问题讨论】:

  • 你有什么解决办法吗?请分享。谢谢。
  • @Waqas 是的,我收到错误的原因是因为我的系统中没有安装组件,它与 unix 系统中的 makefile 相同,即使用已安装的节点组件来运行任务.

标签: javascript node.js makefile


【解决方案1】:

该文件使用与任何 unix/linux 系统中相同的 make。 该错误是由于component 包不可用造成的。我安装了component 使用:

npm install -g component

【讨论】:

  • 谢谢老兄,你是救命恩人 :)
  • @Waqas,没问题。你在做这个项目吗?
  • 不,先生,另一个电子商务相关项目需要它。
猜你喜欢
  • 1970-01-01
  • 2013-03-05
  • 2013-08-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多