I am installing nodejs module(jasmine-ajax) in my local machine . I am expecting the entire libraries in git hub will be available in my local system.
But I am seeing only the main file in lib folder . Where the other dependend files will be placed.
npm install --save-dev jasmine-ajax
Executed the above command and I am not seeing all the files under source in my local view.
https://github.com/jasmine/jasmine-ajax
Thanks
When you install a module like you did, it is placed in node_modules folder.
Running npm install is not getting all file from github repository, but from architecture that is pushed to npm. In the jasmine-ajax github, you can see a file called .npmignore which contains src. This file works like .gitignore files, src folder is excluded when he pushed is module to npm.
File in lib folder is generated from src folder files, so it contains all you want
mock-ajax.js file, in lib folder, represents the built library. You don't need to have all files in src when you download it from npm. You can use all jasmine-ajax features in this way:
Install jasmine-ajax from NPM via npm install --save-dev jasmine-ajax;
you can then require('jasmine-ajax') inside your test-suite and access
it via the jasmine global.
When you launch a npm install without the -g flag the folder that you have to look for is node_modules in the path where you launched the command.
If you use -g flag it will be installed as a global module.
In your case the folder will be node_modules/jasmine-ajax.
The fact that the lib folder contains only the mock-ajax.js file depends on the release they made on npm registry.
The npm install command DOES NOT clone the github repository, it downloads the release from the npm registry: https://www.npmjs.com/package/jasmine-ajax
Related
i'm making a custom package for a project that i'm making, but it requires typescript to be installed as a local dependency...
npm i typescript #types/node ts-node ts-node-dev
This installs it in a node_modules folder, as per usual. The problem is though is when i try to locally install the package...
npm i ../package
it automatically creates a node_modules folder, and then installs it there. The package is installed inside a node_modules folder, within a package folder, within another node_modules folder.
My question is: how do i install it in the parent node_modules folder as a dependency alongside the custom one?
I am trying to follow with pluralsight tutorial and he wrote npm install on the terminal, then a file called npm module is installed on the folder he specified. when I try to install npm this appears to me in the terminal, and the directory which Im trying to install npm on it contains only one document called package-lock.json enter image description here
npm install uses the package.json to install the necessary packages
I can see when you ls, there's no package.json in the directory, just the package-lock which is created where ever you run npm install
Make sure you run the npm install from the same directory the package.json in contained in
the problem is solved, I think that I download the web-dev-starter folder twice by mistake.
I tried to run npm install and npm start but both does not work. I reinstalled the nodejs but still the same. How to resolve it?
If you're trying to install the dependencies of an existing project (which the context implies), you need to run the command npm install in the directory where the package.json file of the project is.
If you've created a new and empty project folder, you need to first run npm init to create a package.json file which is used to manage the dependencies of your project.
Are you sure you're in the head directory? For example, if your project is in:
$ Documents/Projects/JS-Projects/Work/Client-Management-App/
Then that's the folder you need to be in: the Client-Management-App/ directory, because that's where the package.json file and the /node_modules/ folder will be created.
Also, have you run npm init? That might be another reason why.
I use this git repo: https://github.com/kudago/smart-app-banner
I downloaded it with git clone https://github.com/kudago/smart-app-banner.
Then I tried to install it from its parent dir with:
npm install --save smart-app-banner
This always installs the source from the github repo instead of from the local source.
How do I get the source being install from the local copy instead of from github?
npm install /path
it is as simple as that
If you run npm install without any arguments, it tries to install the current folder.
Go to that folder and type npm Install
or
Just put that downloaded File in Node_modules folder of your project.
When I run npm install grunt I get, in my opinion, a heavily polluted project folder. In the folder node_modules there are libs like rimraf, coffescript and others I really don't want to use. Are these required for grunt itself to be able to run or are they only there for my convenience?
I would like some kind of "npm install grunt --minimal" to only install an absolute minimum of what's needed to be able to use grunt. I don't really like my project folder full of stuff that's not really my own code. I've googled the terms i can come up with, like "minimal grunt install", but only found the basic install tutorials.
Create a node_modules directory in a directory above your project's directory and do npm install grunt there. That way the modules are accessible but they aren't in your project's node_modules directory.
Another option is to use npm install -g grunt to install grunt globally.
No, you can not. Grunt is npm package and it has dependencies (this is normal). The fact is this dependencies don't pollute your project folder structure. It is normal to
add node_modules to .gitignore and don't commit it
install every npm package with --save flag (will write package to package.json) or --save-dev flag (will write package to package.json as package needed for development)
commit package.json to repository. Thus, every team member can install all packages via npm install or npm install --production
As Dan said you can install grunt globally with -g flag but this will not solve your problem as every npm package that you install will have it own dependencies (and you'll probably think that it pollutes you folder structure as well)
You know, there are a lot of things that you need for development (or production). While installing apache (or something else) you don't say that is pollutes your file system (but it has own folder and so on).
Things don't pollute file structure if they don't exist in your project repository.
use pnpm
pnpm creates the "deep" node_modules that you want
also saves disk space and network traffic : )
alternative: npm install --legacy-bundling
to produce a deep node_modules