require

ecstore 安装后提示require function does not exist in....

匿名 (未验证) 提交于 2019-12-02 22:11:45
解决: 安装好后,修改config.php里的TMP_DIR,指向网站目录下的data目录(用绝对路径) // define('TMP_DIR', '/data/www/data/tmp/'); 先屏蔽 转载请标明出处: ecstore 安装后提示require function does not exist in.... 文章来源: ecstore 安装后提示require function does not exist in....

emacs 利用 auto-complete 自动补齐

匿名 (未验证) 提交于 2019-12-02 21:59:42
1,首先导入melpa,在文件~/.emacs中添加下面代码 (require 'package) (package-initialize) (add-to-list'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) 2,在emacs中敲M-x package-list-packages后,会显示出一堆可以安装的emacs 插件,然后找到auto-complete,鼠标点击,安装 3,在文件~/.emacs中添加下面代码 (require 'auto-complete-config) (ac-config-default) 文章来源: emacs 利用 auto-complete 自动补齐

node.js,express入门看详细篇

匿名 (未验证) 提交于 2019-12-02 21:53:52
先最简单的代码 安装 npm install express app.js 代码内容 const express = require('express') const app = express() //单项流动 const mid1 = () => (req, res, next) => { res.body = '请求1<br/>' next() } const mid2 = () => (req, res, next) => { res.body += '请求2<br/>' next() } app.use(mid1()) app.use(mid2()) app.get('/', (req,res,next) => { res.send(res.body +'业务处理中') }) app.listen(2334) var express = require('express'); //引入express var swig = require('swig'); //引入swig模版引擎 同类的还有ejs bug var mongoose = require('mongoose'); // 引入数据库 mongoose 需预先安装数据库 //加载 bodeyparser var bodyParser = require('body-parser'); // 引入 body

.1-浅析express源码之入口文件

匿名 (未验证) 提交于 2019-12-02 21:53:52
  鸽了鸽了,webpack源码大垃圾,看了那么久,感觉自己越来越渣……还是换个口味,node了解一下?   尝试从express框架源码入手,学习一下node的http模块相关的知识。 入口文件   先从框架的主文件入手,该JS文件包含三大部分: 1、外部/工具模块引入与属性挂载 2、主函数定义 3、中间件的分离提示      首先是第一块,具体的相关代码如下: var bodyParser = require('body-parser') var EventEmitter = require('events').EventEmitter; var mixin = require('merge-descriptors'); var proto = require('./application'); var Route = require('./router/route'); var Router = require('./router'); var req = require('./request'); var res = require('./response'); // 内部模块 exports.application = proto; exports.request = req; exports.response = res; // 构造方法 exports.Route =

nodejs中的require,exports使用说明

匿名 (未验证) 提交于 2019-12-02 21:53:52
模块是一门语言编写大项目的基石,因此,了解如何组织、编写、编译、加载模块很重要。这里主要谈谈Node中的模块加载。   1.Node中的模块,主要使用 require 来加载模块,文件   require("./") --- 加载本文件夹下面的package.json,如果没有,则加载index.js、index.node   require("some.js") --加载本文件夹下面的some.js文件   require("lib/some.js") --加载lib/some.js文件   require("modulename") --加载当前目录node_modules/modulename文件夹内的package.json,如果没有,则加载index.js、index.node。如果当前目录找不到以上内容,则进入指定全局模块缓存目录中加载modulename文件夹中的内容,如还未找到,则进入系统环境变量NODE_PATH指定的路径中加载modulename文件夹内的内容。涉及到的目录,请参看npm路径设置。   2.Node中创建/导出模块: module.exports   Module.exports才是真正的接口,exports只不过是它的一个辅助工具。 最终返回给调用的是Module.exports而不是exports。   所有的exports收集到的属性和方法

webpack4 plugins ƪ

匿名 (未验证) 提交于 2019-12-02 21:53:52
demo 代码点此 ,篇幅有限,仅介绍几个常用的。 start 什么是 plugins ? While loaders are used to transform certain types of modules, plugins can be leveraged to perform a wider range of tasks like bundle optimization, asset management and injection of environment variables. plugins 可用于执行范围更广的任务,如打包优化,资源管理和重新定义环境中的变量。 HtmlWebpackPlugin 该插件将为你生成一个 HTML5 文件, 并帮你引入 webpack 打包好的 js 等文件. 安装: npm i -D html-webpack-plugin 在 webpack.config.js 中配置: const path = require('path'); + const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { // mode: 'production', mode: 'development', // 入口 // entry: './src/index

报错集锦

匿名 (未验证) 提交于 2019-12-02 21:53:52
1.在node后端使用express中的multer中间件来实现文件上传时报错    node multer 报错 Unexpected field 1 var express=require('express'); 2 3 var router=express.Router(); 4 5 var upload=require('...') router.post('/upload',upload.single('fileid'));     原因:upload.single()里面的参数fileid需要和前端from表单中input输入框的name属性的值保持一致 文章来源: 报错集锦

显微镜下的webpack4入门

匿名 (未验证) 提交于 2019-12-02 21:53:52
前端的构建打包工具很多,比如grunt,gulp。相信这两者大家应该是耳熟能详的,上手相对简单,而且所需手敲的代码都是比较简单的。然后webpack的出现,让这两者打包工具都有点失宠了。webpack比起前两者打包工具,对于前端程序员JS编程能力的要求还是挺高的。不过需要兼容ie8及以下的小伙伴们,就不要考虑webpack了,他很傲娇地不兼容! webpack,这是一个组合词“web”+“pack”,web就是网站的意思,“pack”有打包的意思,webpack组合在一起就是网站打包的意思,这个名字相当暴力简单明了啊。webpack这款工具虽然很难学,但是自由度很大,玩转之后有种随心所欲的感觉。 在学习webpack之前,有几个基础的概念: JavaScript,如果这个编程能力不过关,比如不清楚ES6的语法,那么webpack学起来有些费力,还是要先去学习基础知识。 nodejs,关于nodejs的日常用法,还是需要了解的,不然webpack改如何启动,都无从下手。 CommonJS,这个规范是需要学习下的,webpack的配置文件就是按照这个规则。 如果以上几个技能都具备,那么恭喜我们可以开始webpack的学(求)习(虐)之旅了。 在使用webpack之前,我们需要了解webpack的工作原理。webpack打包出来的JS不仅仅是压缩混淆我们的源文件,而且还对它做了其他的处理

Scala 槽点 - require

匿名 (未验证) 提交于 2019-12-02 21:52:03
require def this ( name : String , age : Int ) = { this () require ( name != null && ! name . isEmpty , "name" ) require ( age > 0 , "illegal age" ) Preconditions . checkArgument ( name != null && ! name . isEmpty , "name required" ) // 使用 guava 工具类,这行编译不过... 改写为下两种调用方式可通过 // Preconditions.checkArgument(name != null && !name.isEmpty, "name required".asInstanceOf[Any]) // Preconditions.checkArgument(name != null && !name.isEmpty, "name required", null) setAge ( age ) setName ( name ) } 什么鬼 require 函数签名: final def require(requirement: Boolean, message: => Any) ,注意第二个参数类型是一个函数 以上栗子中调用了两次 require

NodeJs require('./file.js') issues

喜欢而已 提交于 2019-12-02 21:33:50
I am having issues including files to execute in my NodeJs project. I have two files in the same directory: a.js var test = "Hello World"; and b.js require('./a.js'); console.log(test); I execute b.js with node b.js and get the error ReferenceError: test is not defined . I have looked through the docs http://nodejs.org/api/modules.html#modules_file_modules What am I missing? Thanks in advance. Change a.js to export the variable: exports.test = "Hello World"; and assign the return value of require('./a.js') to a variable: var a = require('./a.js'); console.log(a.test); Another pattern you will