Where to download npm modules manually? - npm

Where can I manually download npm modules? Due to requirements I don't want to use npm on the command line.

How to install a node.js module without using npm? Looks like your question is also here. You need to download their source from the github. Find the main file and then include it in your main file.

Related

Where does npm store module when loading directly from github?

I have found a react-native module I would like to use. It contains an error which prohibits the installation.
I have forked the repository and corrected the mistake.
Now I want to install my module in order to use it, however during execution of the post installation scripts I get an error - file not found.
I have tried to find the reason for it, but the reason is quite simple, the module is not in the node_modules directory, and when npm tries to "enter" there to run the scripts, it can't find them.
I have tried to check where this is installed, but I can't.
I use npm install <user>/<repo> to install my module.

Transpile with babel after npm install

I installed this package: https://github.com/feathersjs/feathers-authentication-local (question not related specifically to this package). This package's source code is in ./src, and npm run compile puts the babel-transpiled code into ./lib, which is the main entry point.
My question is, after I do npm install feathers-authentication-local, how does npm know that it needs to run npm run compile? I thought of putting a postinstall script in package.json, this package doesn't have that.
Regarding what is uploaded to npm when publishing, there are two fields in package.json, files and directories, which are used to specify what should be uploaded.
Take a look as well to "main" property, it points to the files that will be used when importing a module in your aplication so:
import foo from 'foo'
Will look into node_modules/foo/$(main) which in this case points to lib/
The package actually doesn't compile after install on client's machines, but it's probably compiled on the mantainer's machine and then published on NPM.
Compiling process is fired by the prepublish script in package.json.

Why people use bower and npm to inject any library into project

suppose i am working with asp.net mvc with VS2013 IDE. we can download angular-ui-router js file from any web site and copy that file in script folder of my project and refer those js file in web pages.
so my question is why i should use bower or npm to download js files like below example. please tell me extra advantage of using bower or npm to download js files ?
bower install
$ bower install angular-ui-router
npm install
$ npm install angular-ui-router
thanks
If the library evolves/updates or if the project is moved, those package managers allows to keep up to date with all the needed plugins, without having to look for each one, download the last/needed version of each one, and moving them where you need.
You don't need to use them if you don't need them. As any tool, they are there if you need them.

Why do NPM node modules contain a bower.json file?

I've been tasked with removing bower where possible and instead using NPM to install modules. I've done a search of the codebase and the only bower.json files are within NPM node modules. I thought that NPM was an alternative to bower, is this incorrect?
I was expecting to find a bower.json file in the project root. As I haven't does it should like NPM is already being used instead?
You can use NPM as an alternative to bower, yes.
Every module has a bower.json because the module wants to support bower and npm as well. Module managers can write stuff like version number, ignore certain files to download, etc. You don't need to worry about these files.
Your package doesn't have a bower.json - perfect. You don't support bower.

Treat project file as npm module

Is there a way using npm to treat a file in the project as a node-module without linking it and it having it's own package.json?
Ideally I could just have a sub-module definition within my main app package.json and be able to install things to a specific module that way.
Here's an example
/app
/index.js
/file.js
/action.js
What I'd like
npm set-as-module ./action.js "action"
Then within any file in my project I can call
var action = require("action")
Then when I want to install specific dependancies for action I could do this
npm install underscore --save --sub=action
This this kind of feature exist within NPM? Anything close to it?
This would offer the following perks
Easy to branch out or publish into full module
ability to require with module string instead of path
I created something to do this
https://github.com/reggi/npm-link-file
npm install npm-link-file -g
npm-link-file ./action.js "action"
It does not handle linked dependancies.