标签:
今天从新过了一边node的基础知识,自己写了一个小例子:
foo.js
exports.setSome = function (x) {return x };
saveData.js
/** * Created with IntelliJ IDEA. * User: Administrator * Date: 15-5-21 * Time: 下午12:17 * To change this template use File | Settings | File Templates. */ var foo = require(‘foo.js‘); console.log(foo.setSome("123"));
配置运行saveData.js却出现了:
该死的原来是引入的路径不对。。。被自己坑了。
把saveData.js改为:
/** * Created with IntelliJ IDEA. * User: Administrator * Date: 15-5-21 * Time: 下午12:17 * To change this template use File | Settings | File Templates. */ var foo = require(‘./foo.js‘); console.log(foo.setSome("123"));
这样就好了。。。。路径问题啊。
标签:
原文地址:http://www.cnblogs.com/duhuo/p/4530890.html