node-modules

Node js adding unwanted modules when I do npm install [duplicate]

拜拜、爱过 提交于 2019-12-23 19:13:56
问题 This question already has answers here : NPM installs dependencies in a wrong place (2 answers) Closed 4 years ago . I am trying to spin up a node service on my mac. When I run npm install in the folder where my node service is, it is installing modules which are not mentioned in my package.json. There are extra modules which I am not expecting and some modules that I expect are missing. What could be the reason? How does the node modules folder get created. Does it use any global set up? I

How can my module require a specific version of npm?

柔情痞子 提交于 2019-12-23 16:45:52
问题 I am writing an npm module which comes with some scripts, e.g. npm run cureCancer . I want these scripts to accept extra parameters, which is possible only with npm 2 and above, e.g. npm run cureCancer -- fast This means that my module depends on npm 2 or newer, so I added the following to package.json: "devDependencies": { "npm": "^2.7.5" } Then I ran npm install . Then I ran npm -v expected: 2.7.5 observed: 1.4.23 . And of course npm run cureCancer -- fast fails. How can my module require a

npm types or typings or @type or what?

北慕城南 提交于 2019-12-23 07:47:14
问题 I'm using VS 2015 update 3, Angular 2.1.2, Typescript 2.0.6 Can someone please clarify what typings versus npm @types versus whatever other hard to find documentation on something there is this month? Or just point the way to documentation on what and how to use these things. Preferably the docs should be up to date. Also, in a related sense, how does one uninstall. Everywhere I look there are helpful extensions to install packages, but nothing to uninstall that I can tell at least. I

Using NODE_PATH with Git submodules

流过昼夜 提交于 2019-12-23 05:14:29
问题 I asked this question about sharing code between Node apps yesterday with no answers, so now I have a more specific question instead of long-rambling one. Is it considered a bad practice to add require paths to NODE_PATH? As I mentioned in my previous question, I'm struggling with finding a way to share common assets between two node apps, and the only sensible solution I could come up with is using git submodules. I would place this submodule, containing common assets such as Mongoose

alias doesn't affect python execution environment in bash

我与影子孤独终老i 提交于 2019-12-23 04:28:14
问题 I'm getting error while executing my shell script alias abs='~/local/bin/abs' echo $(which abs) source /home/rundeck/.bashrc # included alias abs as well. I'm just sourcing it twice. python batch_update_autobuilds.py <- I'm getting an error here ($which abs) prints,,, alias abs='~/local/bin/abs' ~/local/bin/abs batch_update_autobuilds.py source code (Where the error is coming from) abscommand = "abs update --test" // --test tag has been recently updated. commandline = subprocess.Popen(

alias doesn't affect python execution environment in bash

不羁的心 提交于 2019-12-23 04:28:09
问题 I'm getting error while executing my shell script alias abs='~/local/bin/abs' echo $(which abs) source /home/rundeck/.bashrc # included alias abs as well. I'm just sourcing it twice. python batch_update_autobuilds.py <- I'm getting an error here ($which abs) prints,,, alias abs='~/local/bin/abs' ~/local/bin/abs batch_update_autobuilds.py source code (Where the error is coming from) abscommand = "abs update --test" // --test tag has been recently updated. commandline = subprocess.Popen(

Google Cloud Speech to Text API - Speaker Diarization

与世无争的帅哥 提交于 2019-12-23 04:08:04
问题 When i am trying to do a speech to text transcribe of a live phone call using web socket. Already included const Speech = require('@google-cloud/speech').v1p1beta1; const speech = new Speech.SpeechClient(); With following config. encoding: 'LINEAR16', sampleRateHertz: 8000, languageCode: 'en-US', useEnhanced: true, enableSpeakerDiarization: true, diarizationSpeakerCount: 2, enableWordConfidence: true, model: `phone_call`, I am getting following response { "results": [ { "alternatives": [ {

Invoke javascript callback repeatedly from C++ module in node.js

元气小坏坏 提交于 2019-12-23 02:29:35
问题 So I am writing a node.js module in C++ which processes data from a camera. I want to invoke a callback function in my app.js file whenever new data is available. What I have at the moment Right now I have in my node javascript file ( app.js ) the following code. Every second it calls a function in my C++-Module and returns the number of frames that have been processed so far: setInterval(function () { var counter = MyCPPModule.NumberOfFrames(); console.log(counter); }, 1000); In my C++ file

Empty object returned for uploaded files with connect-multiparty

谁说胖子不能爱 提交于 2019-12-23 01:05:22
问题 Trying to get file details with connect-multiparty but its returning an empty object. var express = require('express'), bodyParser = require('body-parser'), app = express(); var multiparty = require('connect-multiparty'), multipartyMiddleware = multiparty(); app.use( multipartyMiddleware ); app.post('/testupload1', function(req, res){ var body = req.body; var file = req.files; console.log(file) // or console.log(body) both empty. } Form : <form action="testupload1" method="post" enctype=

Get file path of imported module

自古美人都是妖i 提交于 2019-12-22 18:42:10
问题 I'm writing a class decorator for my controllers. It looks like: export function Controller<T extends { new(...args: any[]): {} }> (ctor: T) { return class extends ctor { public readonly name = name; } } ctor is a constructor of a class decorated with @Controller . Full path to the controller's file is src/modules/{module}/controllers/{ctrl}Controller.ts . I need to get parts in curly braces and concatenate them into {module}.{ctrl} . To do so I need a filepath of module from which ctor is