how to install node-mongodb-native with nodejs in windows - windows

I use nodejs and mongoose to save document to mongodb in windows in development, but I fail to connect to mongodb. My nodeunit test is always being blocked to the line mongoose.connect().
I found mongoose use node-mongodb-native. My question is:
Do I need to do some special instructions to install node-mongodb-native in windows 7 (64-bit)?
How to install node-mongodb-native in windows?

Mongoose has a dependency on the npm package monogodb.
If you look at the npm page for mongodb here, https://npmjs.org/package/mongodb, you'll find the homepage form the package is http://mongodb.github.com/node-mongodb-native/
That page is node-mongodb-native.
So, there's nothing you need to do special to get it, as doing
npm install mongoose
is enough to install the native package.

Related

why does npm gives me warning when i try to install jquery-csv library using VS in ubuntu

I'm trying to install jquery-csv library
with visual studio in ubuntu for the first time
the instruction says that to install package I should run:
npm i jquery-csv
however whenever I tried it npm warns me that it can't find package.son:
is this something i'm expected to see in a normal package installation?
if not, please help me with some instructions
The error you're getting suggests you aren't using a Node.js project and don't have a package.json file.
If this is an existing browser-based project and you want to add the library, you can download jquery.csv.min.js from here: https://github.com/typeiii/jquery-csv/tree/master/src , and add a client-side (browser) reference in your HTML file as shown on the readme:
<script src="jquery.csv.min.js"></script>
If you're working on a new Node.js project, the first step is to run npm init, see npm init - create a package.json file

Do NPM packages have to be installed globally to access their functionality via the command line?

I am having trouble understanding how the -g flag works in NPM. Specifically I'm struggling to understand how it relates to command-line functionality exposed by NPM modules.
I assumed that the difference between installing a package locally and globally was simply that a local package would not be available outside of the particular project. And of course that a globally installed package would be available in any project. I'm from a Rails background so this for me would be similar to installing a gem into a particular RVM versus installing it into the global RVM. It would simply affect which places it was available.
However there seems to be more significance than just scope in NPM. For packages that have command-line functionality, like wait-on, the package (as far as I can tell) is not available on the command line unless it's installed globally.
Local install doesn't make the command-line functionality available:
$ npm install wait-on
$ wait-on
=> -bash: /usr/local/bin/wait-on: No such file or directory
Global install does expose the command-line functionality
$ npm install wait-on -g
$ wait-on
=> Usage: wait-on {OPTIONS} resource [...resource]
Description:
wait-on is a command line utility which will wait for files, ports,
sockets, and http(s) resources to become available (or not available
using reverse flag). Exits with success code (0) when all resources
are ready. Non-zero exit code if interrupted or timed out.
Options may also be specified in a config file (js or json). For
example --config configFile.js would result in configFile.js being
required and the resulting object will be merged with any
Can you expose the command-line functionality using a local install?
Is it possible to install locally but also get the command line functionality? This would be very helpful for my CI setup as it's far easier to cache local modules than global modules so where possible I'd prefer to install locally.
If you are using npm 5.2.0 or later, the npx command is included by default. It will allow you to run from the local node modules: npx wait-on
For reference: https://www.npmjs.com/package/npx
I think you can access locally installed modules from the command line only if you add them to your "scripts" section of your package.json. So to use the locally installed version of wait-on, you can add an entry in "scripts" section of package.json like so "wait-on": "wait-on". Then to run it, you would have to do npm run wait-on. You can also do "wo": "wait-on" and then do npm run wo basically meaning what comes after the run is the script entry. In node_modules, there is a .bin folder and inside of this folder is all the executables that you can access this way.
Installing locally makes the package available to the current project (where it stores all of the node modules in node_modules). This is usually only good for using a module like so var module = require('module'); or importing a module.
It will not be available as a command that the shell can resolve until you install it globally npm install -g module where npm will install it in a place where your path variable will resolve this command.
You can find a pretty decent explanation here.
It is also useful to put commands in the scripts block in package.json as it automatically resolve local commands. That means you could have a script that depended on a package without having an undocumented dependency on the same.
If you need to run it locally on cmd, you have to go inside the node_modules and run from the path.

how can I manually install a module in qpython?

I am using qpython as a non-root user and I have googled it up but all recommendations don't work both manually and using pip...I keep on getting errors...
I get erors when I use both:
pip install requests from pip console
and:
import pip
pip.main(['install','requests']) on python console
The error is something like:
cannot fetch base url https://pypi.python.org/simple/
could not find any downloads that satisfy the condition requests
...
if there is a workaround or a fix I would be happy to accept...
Did you use the newest version(>=2.0.7) Installing requests from QPYPI works well in the newest version. https://github.com/qpython-android/qpython/releases
Yes! This fixed my problem once I used the beta v2.1 from
https://github.com/qpython-android/qpython/releases
Google play did not give me the latest version (I had 1.xx)
I was able to use QPYPY to install requests and it automatically installed the required library urllib3.

Jhipster import-jdl not generating entities

I am running into a problem with import-jdl and I am not sure why it is not working. I am trying to generate entities for microservices application.
All I get is
The jdl is being imported.
but nothing else.
I used the sample https://jhipster.github.io/jdl-studio/ entity provided by JDL without any modification.
I have tried this in my Mac, Linux (Ubuntu), and Docker container but I get the same error.
Here are the versions of the software:
JHipster Generator: v3.3.0
npm : 3.9.2
yo : 1.8.3
Microservices Application
------- Application files will be generated in folder: /Users/anand/Desktop/jhexample
JHipster update available: 3.4.0 (current: 3.3.0) Run npm install
-g generator-jhipster to update. ______________________________________________________________________________
? (1/16) Which type of application would you like to create?
Microservice application
? (2/16) What is the base name of your application? jhexample
? (3/16) As you are running in a microservice architecture, on which
port would like your server to run? It should be unique to avoid port
conflicts. 8081
? (4/16) What is your default Java package name? com.anand
? (5/16) Which type of authentication would you like to use? JWT
authentication (stateless, with a token)
? (6/16) Which type of database would you like to use? MongoDB
? (7/16) Would you like to use Maven or Gradle for building the
backend? Maven
? (8/16) Would you like to enable internationalization support? No
? (9/16) Which testing frameworks would you like to use? (Press
to select)Gatling
...snip...
Server app generated successfully.
anand$ yo jhipster:import-jdl ./jhipster-jdl.jh
The jdl is being imported.
I've faced the same situation: The jdl is being imported but nothing is generated. As Vikas Joshi suggests try using jhipster-uml:
npm install -g jhipster-uml
jhipster-uml ./jhipster-jdl.jh -db mongodb
jhispter-uml usually returns more feedback. Anyway take into account that in MongoDB as noSQL database that it is, some options have no sense (e.g relations between entities).
if you are here because your jhipster import-jdl youfile.jdl doesn't create java code for entities but reportes the entities are imported, please try
jhipster import-jdl youfile.jdl --force
I was also struggling with the same error (for MySql i.s.o MongoDB). I used jhipster-uml i.s.o jhipster:import-jdl to create Entities and it worked for me. Hope it works with MongoDB as well. Don't exactly know why it does not work with import-jdl.
I've run on the same issue on my OSX. Currently I've managed to workaround this through a virtual-machine on linux(debian/ubuntu) using the jhipster-generator version 3.4.0 . Newer version will not create the entities even for me.
Please try to delete all stuff installed from bottom to top from the instalation guide here until nodejs part.
So yo will done the following:
npm uninstall -g generator-jhipster
npm uninstall -g gulp
npm uninstall -g bower
npm uninstall -g yo
Then follow steps to remove nodejs from here
After uninstalling start again installing nodejs and commponents as suggested on jhipster guide with the only difference at the last step:
npm install -g generator-jhipster#3.4.0

Running Expresso TDD in Node.js on Windows

Has anyone been able to get this to work?
Environment:
Windows 7 64-bit
node.js v0.6.7
npm 1.1.0-beta-10
expresso 0.9.2
I've successfully installed via npm from zip download (after modifying package.json to remove node-jscoverage dependence). 'npm ls' lists expresso as installed. After overcoming the problem described here by commenting out the reference to SIGINT, expresso will execute from cmd window. However, when I actually attempt to run test suites, I get a 'Cannot find module' error when it tries to open the first test suite. Any help would be appreciated.
You'll have to install the module locally, too.
Have you considered using mocha? It's supposed to be expresso's successor, written by the same author.

Resources