在OSXterminal中找不到NPM Global Package CLI

我在安装express和express-generator并尝试使用express cli生成内容时遇到了问题。 当我使用npm install -g express和npm install -g express-generator ,但是在重新启动terminal之后,一切顺利,但是我不能使用快速文档 经过一番调查,我发现express和express-generator安装到: /usr/local/lib/node_modules/node/lib/node_modules 然而,在我的机器上工作的唯一软件包(像Yeoman,Grunt,我经常使用没有问题的东西)在这里安装: /usr/local/lib/node_modules/ 那么这里的交易是什么? 为什么我的install -g软件包进入node/lib/node_modules ? 我试过在我的.bash_profile使用export PATH=/usr/local/lib/node_modules/node/lib/node_modules:$PATH ,但是这似乎并没有帮助我。

不能NPM当需要在test / index.js中需要selenium-webdriver的testing时启动

所以我正在尝试使用webpack和selenium-webdriver在JavaScript项目上进行testing。 但是,当我需要从test / index.js文件的testing文件,以便在浏览器中运行它们npm开始崩溃与一系列'无法解决模块'错误。 我所需testing的标题如下所示: //=> test/meal_test.js const assert = require('chai').assert; const webdriver = require('selenium-webdriver'); const Meal = require("../lib/meal.js") const until = webdriver.until; const frontEndLocation = "http://localhost:8080" describe('test meal object', function() { it('should meal info and food info', function() { const meal = new Meal({ "id": 1, "name": "Breakfast", "foods": [ { "id": 4, "name": […]

我无法在v-for loop |中绑定图像源 vue.js,node.js

我尝试在v-for循环中绑定图像源。 我的数组是由函数填充,而不是静态的。 我的代码看起来像: <section class="section"> <div class="container"> <div v-for="match in matches" class="card"> <img :src="match.avatar" alt=""> </div> </div> </section> 和 created() { ipcRenderer.send('get:all:champions') ipcRenderer.send('summoner:recent:matches:request') ipcRenderer.on('summoner:recent:matches:response', (event, matches) => { matches.splice(-15, 15) // -15, 15 this.matches = matches for (let match in matches) { ipcRenderer.send('matches:champion:avatar:request', { element: match, championId: matches[match].champion }) } ipcRenderer.on('matches:champion:avatar:response', (event, data) => { […]

docker-node:作为非root用户运行,文件权限

遵循docker-node的最佳实践 ,我想以非root用户的身份运行我的节点应用程序。 build议如下: FROM node:6.10.3 … # At the end, set the user to use when running this image USER node 我简化的Dockerfile目前看起来像这样: FROM node:6.10.3 WORKDIR /opt/app COPY package.json . RUN npm install COPY . . EXPOSE 3000 USER node CMD ["node", "server.js"] 因此,在映像构build期间添加的所有文件都由root拥有,但node server.js node作为node用户运行。 这似乎工作正常。 我的问题:是否有任何额外的安全好处chown文件,以便他们属于node而不是root ? 即做类似的事情: RUN chown -R node:node .

Node.js AJAX删除403禁止

我尝试创build从服务器删除图像的方法。 现在我只想处理DELETE请求,并显示在控制台filePath …服务器不处理我的请求,并发送: jquery.min.js:4 DELETE http:// localhost:3000 / api / imagesbg / wedding-stock-2.jpg 403(禁止) 我做错了什么? 前(handlebars.js) {{#each images}} <div class="row"> {{#each this}} <div class="col-sm-4"> <img src="/images/background-slider/{{this}}" class="img-responsive img-thumbnail" alt="{{this}}"> <button type="button" class="btn btn-danger pull-right imgBgDel" file-name="{{this}}" > Delete </button> </div> {{/each}} </div></br> {{/each}} 脚本 $(function(){ $('.delete-msg').hide(); var url; $(".imgBgDel").on("click", function(){ var url = 'http://localhost:3000/api/imagesbg/' + […]

如何从angular2发表到服务器

这里的新手试图从Angular 2发送联系表单数据到Node / Express服务器…现在,我正在托pipeAngular 2,内置服务器在localhost:4200,而express server在localhost: 3000。 我试过下面的代码,但得到以下错误: Error: ENOENT: no such file or directory, stat 'C:\Users\corey\Desktop\Project\server\api\contact-form-submit' 这是我的contact-form.component.ts文件: import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-contact-form', templateUrl: './contact-form.component.html', styleUrls: ['./contact-form.component.css'] }) export class ContactFormComponent { constructor(private http: HttpClient) {} […]

在Google App Engine上部署socket.io

如何在App Engine上部署和运行Node.js中编写的socket.io服务器。 它是否支持? 如果不是我可以使用什么替代scheme 这是我的sockets: var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendFile(__dirname + '/index.html'); }); io.on('connection', function(socket){ console.log('a user connected'); socket.on('disconnect', function(){ console.log('user disconnected'); }); socket.on('subscribe', function(room) { console.log('joining room', room); socket.join(room); }); socket.on('send message', function(data) { console.log('sending room post', data.room); socket.broadcast.to(data.room).emit('conversation private post', data.message) }); […]

如何使用Azure函数绑定发送预定的服务总线队列消息?

我有一个写在node.js中的Azure函数,它使用输出绑定成功地将消息发送到Azure服务总线队列。 我怎样才能发送一个预定的消息到同一个队列仍然使用绑定语法? 如果可能的话,我宁愿这样做,而不安装node.js sdk。 绑定文档没有提到预定的消息。 然而,有趣的是, 这个评论已经在函数github问题库上做了几次: 至less使用C#&Node.js(以及为什么不在F#中)Service Bus队列输出已经支持这个,例如,如果创build并放置多个消息,例如给IAsyncCollector或创buildBrokeredMessage。 在您的传出信息中,您可以控制预定的排队时间: outgoingMessage.ScheduledEnqueueTimeUtc = DateTimeOffset.UtcNow.AddSeconds(10) 无论如何,这是我目前的代码,工作正常,立即传递消息: function.json { "disabled": false, "bindings": [ { "authLevel": "function", "type": "httpTrigger", "direction": "in", "name": "req" }, { "type": "http", "direction": "out", "name": "res" }, { "name" : "queueOutput", "queueName" : "scheduler", "connection" : "AZURE_SERVICEBUS_CONNECTION_STRING", "type" : "serviceBus", "direction" : "out" } […]

dynamic网站使用AWS

我想要使​​用AWS无服务器托pipe一个dynamic网站。 我打算使用Lambda,API网关,DynamoDB和S3。 我的前端页面将驻留在S3中。 拦截器是会有一些dynamic的项目,如用户名和其他元数据将是用户特定的。 我知道到目前为止,我们能做的最好的事情就是从S3中拉出html页面。 那么我如何继续并在这些页面中包含这些variables? 我将在NodeJS中编写lambda。

增加ghcjs调用的节点的内存

当我在一个大型的代码库(〜10k LOC,大量的模板haskell)上运行ghcjs的时候,我得到了这个错误: fd:40: hPutBuf: illegal operation (handle is closed) 我最好的select是这是一个内存不足的错误。 当我重新运行构build它通常第二次或第三次(可能是因为它可以build立在以前的运行部分结果?)。 现在我想知道是否有一个方法给节点更多的内存比1GB(我认为?),它得到默认情况下。 有–max_old_space_size ,我在这里search“增加节点内存”时发现的,但我还没有find一种方法来从ghcjs调用该parameter passing给节点。 谢谢! 编辑:可能相关: https : //github.com/ghcjs/ghcjs/issues/601,https : //github.com/ghcjs/ghcjs/issues/588