Express cannot find module "rmp-api" - node.js

I am trying to use an api from github that takes rate my professor ratings and the instructions were fairly clear. https://github.com/shafi-dayatar/rmp-api
npm install rmp-api --save
which worked but once I require it
var rmp = require('rmp-api');
It gives me the error
Error: Cannot find module 'rmp-api'
I've tried rebuilding the app, reinstalling all the dependencies and still nothing. Is there something I might be missing from the installation?

The rmp-api package is no longer hosted in NPM. At this time, if you visit the npm page for rmp-api, you will see the following description:
This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
It appears this happened 9 months ago, and based on the last commit being in August of 2016, I'd guess this package has been abandoned. If you want to use it, you can install it using the githubname/reponame syntax (see the documentation for more details):
npm install --save shafi-dayatar/rmp-api

Related

I’d like to install and require “fs”, ”path”, and “js-yaml” in Windows 10 but only “js-yaml” led to "Error cannot find module "

 Nice to meet you. I'm a beginner in computer and these days have enjoyed your sophisticated Q&As here. This is my first question in StackOverFlow. Please forgive me when I use not common notations and unnatural English.
 I trid for several hours to install external modules in Node-Red (Node.js ?).
I’d like to install three---“fs”, ”path”, and “js-yaml”--- in Windows 10 but my trouble is that only “js-yaml” resulted in failure although the others can be successfully installed and used.
 I tried the following command…
C:\windows\system32>npm –g install js-yaml
C:\windows\system32>npm –g install fs
C:\windows\system32>npm –g install path
These commands created the modules, but only js-yaml behaved differently from the other two. After adding appropriate keys and properties such as “ fs: require(‘fs’)” to functionGlobalContext in (C:~~~/.node-red/) setting.js, I tried to start Node-Red.
When I commanded
C:\windows\system32> node-red
it returned the following errors only on js-yaml and node-red did not open. It ran successfully when I removed the term “jsyaml: require(‘js-yaml’)” from setting.js.
Error loading C:~~~/.node-red/setteing.js
Error cannot find module “js-yaml”
I’ll list reports which may be related with my problem.
*The other two (fs, path) created the folders only in the directory “C:~~~/npm/node-modules”, but js-yaml created another js-yaml file apart from there in “C:~~~/npm”.
*Perhaps I tried “npm link” command in each directory before install command. And npm link [module name] in C:~~~/.node-red directory.
*I downloaded external module (node-red-contrib-postgres) from github, which may have fs.js and path.js??
*It did not change the result to add “js-yaml” term into “dependency” in (C:~~~/.node-red/) package.json.
*I add C:~~~/npm.node_modules(got by "npm -g bin"command) to enviroment variable "PATH"
I would suggest you install them locally, not globally.
When you install npm modules globally using -g, they are stored under %APPDATA%\npm, which is user-specific, and to which Node Red may not have access, depending on how it's being run.
Have a look at Running on Windows under "Sharing Node-RED between Users" and npm-folders for further info.
Alternatively, you can also put the actual path in functionGlobalContext, which may work for you. Along the lines of:
js-yaml: require(‘/the/path/to/js-yaml’)

How to resolve bycrypt dependency issue in module.

I keep getting this issue:
[snip of my issue][1]
I'm teaching myself node and am trying to make a CRUD RESTful application in my spare time. I'm working off this book:
https://leanpub.com/mean-machine.
For the past 3 days I've been stuck with this issue. It is specifically concerning the bcrypt-node.js . It's job is to hash passwords. Some things I have tried.
Downloaded python 3.5 as I got errors saying the runtime was needed to execute.
Setting python environment variable in PATH
npm uninstall and install.
Tried creating a new project, same issues cropped up.
npm clear cache
Since it is an old version of the bcrypt-node.js module changed the version in package.json from "0.0.3" to "0.0.5". I thought it could be a bug. Unlikely as that is.
I'm very new to node.js so I feel like I'm doing something silly that I just cannot see. Also I don't understand a lot of the information the command line is providing me. Thank you in advance.
EDIT 1:
Picture of my code.
Edit. (For future visitors) I needed to pay more attention to the various dependencies and a further understanding of JS in general to utitlise the power of Node.js, which is something I didn't do. Also recommended is a good understanding of Express.
A deeper understand of the npm is needed.
I found a fix through trial and error and some googling.
In case any one looks up this again in the future I entered:
npm install node-gyp -g && npm cache clean && rm -rf node_modules && npm installinto the command line and it appeared to fix the issue when I ran nodemon server.js
Fingers crossed it does not crop up again.
If someone would like to explain to me what exactly was the problem I had I would really appreciate it. I have a feeling a module or dependency wasn't installed correctly?
EDIT 1. Furthermore configure the PATH in your environment variables.
ie I created a path for python in the command line
PATH python = C:\Python27\python.exe & another PATH for MongoDB
i.e C:\Program Files\MongoDB\Server\3.2\bin

How do you use tfs-cli in a disabled network environment?

Our TFS build server does not have access to the internet. After getting node.js installed next I tried to install tfx-cli. using the command:
npm install -g tfx-cli
As far as I can tell, now it wants to download dependencies required. It looks like a whole web of dependencies - nuget style. Am I expected to set up an internal npm server with the dozens of dependencies required, becoming an expert on node.js and npm - just so I can add some custom commands to our TFS server?
Is there a version of tfs-cli I can get that includes all dependencies ?
I know this is old, but I just happened to come across your question. Hopefully this will help others.
Although I haven't tried it myself, there do seem to be ways of installing NPM packages offline. Here's one Stack Overflow answer that may get you pointed in the right direction. Another solution I've seen recommended is npmbox.

How can I unflatten the node module?

My current npm version is 3.7.3 . Previously, only the required packages were getting installed in my node modules. But right now they have all flattened and have 100 + folders visible when I look into node modules. I prefer the older way where you could go into individual folders and see their dependencies.
here is a similar thread:
Why does npm install many packages into "/node_modules" instead of only one?
I tried running npm uninstall without much success.
Basically, you are out of luck... NPM does not provide any configuration options regarding this. It will nest dependencies if it must in order to resolve version conflicts, but only in this case. Your only option is to downgrade NPM (not recommended). However, if you just need to see the dependencies nested for informational reasons, you can use npm ls. It will draw you a graph.
See this relevant NPM issue for more discussion: https://github.com/npm/npm/issues/9809
Now that node js' LTS doesn't include an NPMv2 I found myself stuck with this issue again.
For those of you also caught out, the link that #KevinBurdett mentioned, also has some answers.
You can force downgrade npm using npm itself (using sudo or equivalent for this). From https://github.com/npm/npm/issues/9809#issuecomment-179702479:
as root I simply do npm install -g 'npm#<3' on my system every time I
a new version of Node comes out; your mileage might vary, but it's
fairly trivial to "downgrade" :-)
Another alternative is to use the Node Version Manager (NVM): https://github.com/creationix/nvm. Your mileage may vary depending upon personal config/preferences/platform.
That said, npm 3 and the issue of flat dependency trees will be with us from hereafter... It's probably high time to start accepting that change.
My personal grudge with this is that it makes the node_modules folder incredibly difficult to work with in an IDE, especially when you need to look at the implementation of your immediate dependent modules, without first wading through 100's of sub-sub modules that are irrelevant to me. It seems that I'm not alone in this matter when you read the comments in the issue. It only leads me to question the viability of npm itself when such changes are made without a proper migration from old to new systems. For me, npm2 will always be king.

Node app fails to run because of prerelease

I get invalid packages installing, even if the installation is a success. Btw, this question is related to the answer - question about versioning
npm install serialport
These are packages which is stuck far in the dependency tree.
npm ERR! invalid: readable-stream#1.0.27-1 /Users/snorre edwin/Code/raspberry-node-server/node_modules/serialport/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream
npm ERR! invalid: string_decoder#0.10.25-1 /Users/snorre edwin/Code/raspberry-node-server/node_modules/serialport/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder
This ends up causing this error in my browser:
Uncaught TypeError: Cannot read property '_ansicursor' of undefined
Is there any way to sort up in this npm problem? Can I avoid these prerelease packages?
The github answere below gave me a lot of insight into npm and I thought I had to dig somewhere else for the issue. But it acctually just seemed like serialport does not work very well, anymore, with browserify. It used to work because i used if for two months, but something changed. When im saying it out loud, it just sounds stupid anyway. So dont browserify serialport.
I recieved an answere on github, issue answere, thought i would share it with the rest who might wonder:
The change in handling prerelease versions in semver#4 is one of the primary motivators for the major version bump to npm#2. All versions of npm 2 are affected by this change, which, put briefly, ensures that all version information to the right of - in version strings is ignored when doing semver range matching. When you upgrade from npm#1 to npm#2, it's normal to see some irregularities show up when you run npm -g ls, and since some packages are distributed as self-contained installs via the use of bundledDependencies, they may come out of the package in a state that is inconsistent with npm#2's rules.
While this won't always work, most of the time the easiest way to fix these issues is simply to uninstall and reinstall the affected package. For packages that ship with bundledDependencies, if you really want to get everything cleaned up, you can cd into the node_modules folder containing the version of the package with the noisy prerelease dependency version and just run npm install problemDependency, and it will use the newest version of that dependency that matches the semver range for that particular package.
Re: your second question, semver range checking is done semantically, not lexically, so 1.0.31 should match with npm#2:
% semver -r '~1.0.2' 1.0.26 1.0.27-1 1.0.31
1.0.26
1.0.31
I suspect that the behavior you're seeing is due to a bundledDependency included in the package tarball.
All of this is documented, so I'm going to close this issue. I hope this clears things up for you!

Resources