草庐IT

global_registry

全部标签

node.js - 错误: Global connection already exists. 先调用sql.close()

嗨,我正在使用sqlserver数据库创建Nodejsrestfulapi,当我使用该api输出以json格式显示时,我准备获取api,同时刷新该浏览器显示“错误:全局连接已存在。调用sql.close()首先。”错误。我正在添加代码varexpress=require("express");varsql=require("mssql");varapp=express();//InitiallisingconnectionstringvardbConfig={user:'sa',password:'India123',server:'localhost',database:'sampl

node.js - 错误: Global connection already exists. 先调用sql.close()

嗨,我正在使用sqlserver数据库创建Nodejsrestfulapi,当我使用该api输出以json格式显示时,我准备获取api,同时刷新该浏览器显示“错误:全局连接已存在。调用sql.close()首先。”错误。我正在添加代码varexpress=require("express");varsql=require("mssql");varapp=express();//InitiallisingconnectionstringvardbConfig={user:'sa',password:'India123',server:'localhost',database:'sampl

javascript - 从 babel-preset-env 中删除 Global "use strict'

我想删除babel-preset-env在babel6.x中添加的全局'usestrict'。我阅读了关于es2015的另一篇文章。我尝试了以下.babelrc配置,但无济于事:{"presets":[["env",{"loose":true}]],"plugins":[["transform-es2015-modules-commonjs",{"strict":false}]]}我不想像其他帖子为es2015建议的那样编辑node_modules中的实际文件。这是一个相当的技巧,不会持续存在。目前唯一的解决方案是使用gulp-iife来包装每个文件。真的没有办法在我的.babelrc

javascript - 从 babel-preset-env 中删除 Global "use strict'

我想删除babel-preset-env在babel6.x中添加的全局'usestrict'。我阅读了关于es2015的另一篇文章。我尝试了以下.babelrc配置,但无济于事:{"presets":[["env",{"loose":true}]],"plugins":[["transform-es2015-modules-commonjs",{"strict":false}]]}我不想像其他帖子为es2015建议的那样编辑node_modules中的实际文件。这是一个相当的技巧,不会持续存在。目前唯一的解决方案是使用gulp-iife来包装每个文件。真的没有办法在我的.babelrc

node.js - Node : use eventEmitter object globally

假设我有3个公开的功能:用户、帖子、文章所有这些都需要将消息发送到一个名为mediator的文件,其中设置了所有事件。目前我在这样做时遇到了麻烦在中介文件中我有这样的东西:varEventEmitter=require('events').EventEmitter;,pubsub=newEventEmitter();exports.pubsub=newEventEmitter()pubsub.on('loggedIn',function(msg){console.log(msg);});在用户、帖子和文章功能中。像这样:varmediator=require('../config/me

node.js - Node : use eventEmitter object globally

假设我有3个公开的功能:用户、帖子、文章所有这些都需要将消息发送到一个名为mediator的文件,其中设置了所有事件。目前我在这样做时遇到了麻烦在中介文件中我有这样的东西:varEventEmitter=require('events').EventEmitter;,pubsub=newEventEmitter();exports.pubsub=newEventEmitter()pubsub.on('loggedIn',function(msg){console.log(msg);});在用户、帖子和文章功能中。像这样:varmediator=require('../config/me

node.js - 将 ApolloClient 与 node.js 一起使用。 "fetch is not found globally and no fetcher passed"

我正在尝试在node.js服务器上使用Apollo客户端来使用以下代码与另一个GraphQLAPI进行交互:importfetchfrom'node-fetch'import{createHttpLink}from'apollo-link-http'importApolloClientfrom'apollo-boost'import{API_URL}from'...'constclient=newApolloClient({link:createHttpLink({uri:API_URL,fetch:fetch,}),})这会产生以下错误:moduleinitializationerr

node.js - 将 ApolloClient 与 node.js 一起使用。 "fetch is not found globally and no fetcher passed"

我正在尝试在node.js服务器上使用Apollo客户端来使用以下代码与另一个GraphQLAPI进行交互:importfetchfrom'node-fetch'import{createHttpLink}from'apollo-link-http'importApolloClientfrom'apollo-boost'import{API_URL}from'...'constclient=newApolloClient({link:createHttpLink({uri:API_URL,fetch:fetch,}),})这会产生以下错误:moduleinitializationerr

node.js - 错误 : Cannot find module 'npm-registry-client'

每当我尝试安装npm-registry-client时,都会收到错误“错误:找不到模块'npm-registry-client'”。我已尝试使用以下命令解决此问题,但这不起作用:npm卸载npminstall-gnpm@latest完整的输出是:user@pc~/devel>npminstallnpm-registry-client--savemodule.js:340throwerr;^Error:Cannotfindmodule'npm-registry-client'atFunction.Module._resolveFilename(module.js:338:15)atFun

node.js - 错误 : Cannot find module 'npm-registry-client'

每当我尝试安装npm-registry-client时,都会收到错误“错误:找不到模块'npm-registry-client'”。我已尝试使用以下命令解决此问题,但这不起作用:npm卸载npminstall-gnpm@latest完整的输出是:user@pc~/devel>npminstallnpm-registry-client--savemodule.js:340throwerr;^Error:Cannotfindmodule'npm-registry-client'atFunction.Module._resolveFilename(module.js:338:15)atFun