require

Uncaught TypeError: Cannot read property 'bool' of undefined after upgrade reactjs

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have just upgraded my reactjs project from 15.4.2 to 16.3.2 , the project compiles fine however, in the browser, I get this error: Uncaught TypeError: Cannot read property 'bool' of undefined at Object.<anonymous> (propTypes.js:3) at __webpack_require__ (propTypes.js:3) at Object.<anonymous> (propTypes.js:3) at __webpack_require__ (propTypes.js:3) at Object.exports.__esModule (propTypes.js:3) at __webpack_require__ (propTypes.js:3) at Object.<anonymous> (propTypes.js:3) at __webpack_require__ (propTypes.js:3) at Object.<anonymous>

Express 4 middleware error handler not being called

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: For certain pages I have custom 500, 404 and 403 error handling in my app. So for instance after an unsuccessful database query I'd go: return next ({ status : 404 , message : 'Record not found' }); or return next ( new Error ( 'Bad things have happened' )}); In my middleware I have an error handler: app . use ( function ( err , req , res , next ) { // handle error }); Problem is that the error handler is never called, instead the error callstack is being printed into the browser. I want the handler to render a custom error page.

How to solve the HTTP error 200, SyntaxError: Unexpected token &lt; in JSON at position 0 at JSON.parse

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can anyone help me with this issue ? I am stuck on this for 2 days,....I really do not how to fix it....I built a web page(contains a table) using angular cli/angular5 and expressjs. I use mongoose mongodb as the database. Everything working fine on local. But When I uploaded the dist folder and deployed it to the azure web app, its table is empty. The error log looks like this: Here is my temp website:" https://stringfr.azurewebsites.net ". you can check the full error log by inspect. I think this is something to do with this line in the

MEAN app with admin panel and client panel

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a mean app which is working perfect with admin panel. My server is listening on: http://localhost:3003 admin panel I can access here: http://localhost:3003/#/admin/ Now I want to separate admin panel and client panel, but client panel is not accessible like when I tried to this url, show nothing http://localhost:3003/#/client I have updated my server.js file also enable multiple views in express v 10.x.x like: app.set('views', [__dirname + '/admin/views', __dirname + '/client/views']); I think problem is with app.get('/', function

egg.js上传文件到本地

匿名 (未验证) 提交于 2019-12-03 00:41:02
‘use strict‘ ; const Service = require(‘egg‘ ).Service; const fs = require(‘fs‘ ); const path = require(‘path‘ ); const sendToWormhole = require(‘stream-wormhole‘ ); class UploadService extends Service { async index() { const ctx = this .ctx; const stream = await ctx.getFileStream(); const fileName = stream.filename; let target = path.join( this .config.baseDir, `app/public/comfiles/${stream.filename}`); const result = await new Promise((resolve, reject) => { const remoteFileStream = fs.createWriteStream(target); stream.pipe(remoteFileStream); let errFlag; remoteFileStream.on( ‘error‘, err =>

底部导航组件组件react-native-tab-navigator的使用

匿名 (未验证) 提交于 2019-12-03 00:40:02
组件react-native-tab-navigator的使用 1、npm安装,导入组件react-native-tab-navigator import TabNavigator from ‘react-native-tab-navigator‘; 2、代码如下 <View style={styles.container}> <TabNavigator> <TabNavigator.Item selected={this.state.selectedTab === ‘home‘} selectedTitleStyle={styles.btselcttext} title="Home" renderIcon={() => <Image style={styles.image} source={require(‘./res/images/Home-home.png‘)} />} renderSelectedIcon={() => <Image style={styles.image} source={require(‘./res/images/Home-home1.png‘)} />} // badgeText="1" onPress={() => this.setState({ selectedTab: ‘home‘ })}> <View style={styles.page}><

requireJS 基本使用

匿名 (未验证) 提交于 2019-12-03 00:37:01
在requireJs 中,.js的后缀是可以省略不写的 <script data-main= " main " src= " require.js " ></script> 在require.js 加载完之后,会查找页面上script标签的data-main属性的值,然后加载,data-main指定的js文件 找到名为main的js文件 通过requireJs同时加载了js1、js2、js3,也可以同时加载更多js文件 第2个回调函数在导入的js文件全部加载完之后才会执 require ([ ' js1 ' , ' js2 ' , ' js3 ' ], function (){ console . log ( ' js1 js2 js3 loaded ' ) var total = num1 + num2 + num3 console . log ( total ) hello1 () hello2 () hello3 () }) 使用requireJs可以很方便的导入js文件,但是要注意js文件中变量名和方法名与其他js文件中变量名方法名冲突的问题 产生冲突的原因: 浏览器端js文件存在共用的全局作用域,全局作用域中变量名、方法名可能会被覆使用requireJs加载js文件,会自动在head标签中添加script标签,这些script标签带有async属性

前端模块化

匿名 (未验证) 提交于 2019-12-03 00:37:01
AMD规范 define( "alpha" , [ "require" , "exports" , "beta" ], function ( require, exports, beta ) { export.verb = function () { return beta.verb(); } }); https://github.com/amdjs/amdjs-api/wiki/require CommonJS规范 var a = require ( "./aaa" ); var b = require ( "./bbb" ); module . exports = { result : a + b } ES6 module import a form "./aaa" ; import b form "./bbb" ; var c = a + b; export {c} 附:AMD规范 https://github.com/amdjs/amdjs-api/wiki/AMD CommonJS规范 http://javascript.ruanyifeng.com/nodejs/module.html 文章来源: 前端模块化

gulp#4.0

匿名 (未验证) 提交于 2019-12-03 00:37:01
gitbook教程: https://dragon8github.gitbooks.io/gulp-webpack/content/an-zhuang-gulp-4-0.html gulpfile.js // cnpm i -g gulpjs/gulp#4.0 && cnpm i gulpjs/gulp#4.0 gulp-sass fs-extra gulp-autoprefixer gulp-sourcemaps browser-sync gulp-ejs gulp-rename gulp-babel babel-core babel-preset-env babel-preset-stage-2 gulp-typescript typescript -S const gulp = require(‘gulp‘ ) const babel = require(‘gulp-babel‘ ) const ts = require(‘gulp-typescript‘ ) const sass = require(‘gulp-sass‘ ) const autoprefixer = require(‘gulp-autoprefixer‘ ) const sourcemaps = require(‘gulp-sourcemaps‘ ) const rename = require(