Hi I am trying to install a module globally which i made to a gzipped tarball.I downloaded the source from github and converted to a tar.gz and then i tried to install it using the following command
npm install forever.tar.gz -g
It threw me the following error
npm ERR! addLocal Could not install /home/administrator/forever.tar.gz
npm ERR! Error: ENOENT, open '/root/tmp/npm-18157/1367900009061- 0.2676603845320642/package/package.json'
My requirement is that i should not connect to any external url (ie) https://registry.npmjs.org/forever for any installation.I should be able to install from the tarball from my directory.I am stuck here any help will be much appreciated.
this error tells you, that the package.json in your tar was not found...
did you change something in your repository? how did you tarball the repo?
i did these steps and everything worked fine:
git clone https://github.com/nodejitsu/forever.git
tar -cvzf forever.tar.gz forever
npm install forever.tar.gz -g
hint: you dont need to tarball the repository, npm install can also be performed on local folders:
git clone https://github.com/nodejitsu/forever.git
npm install forever/
Related
I am trying to clone a remote react-native project but I am getting errors when running the npm install command to download all the dependencies in the package.json folder.
I am in the same root directory where the package.json file is.
This is what I get when running npm install:
when I try doing npm install --force or npm install --legacy-deps I get:
I've tried uninstalling node reinstalling to the LTS and current version.
This is the process I followed when trying to install the dependencies:
clone remote repo
npm init
npm install
I am not quite sure what else to do any help would be greatly appreciated.
First you need to get in project directory then install the node packages
cd <ProjectName>
npm install
I can successfully
git clone https://[org].visualstudio.com/_git/[repo]
but if I run
npm install https://[org].visualstudio.com/_git/[repo] --save
I get
npm ERR! fetch failed https://[org].visualstudio.com/_git/[repo]
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 203
Is it possible to install npm packages from Team Services git repos like you can from github?
If you want to install a package from a specific Git repo you need to structure the URL as follows, notice that the url is prepended with git+https://
npm i --save git+https://[org].visualstudio.com/_git/[repo]
This will also work if you want to install your repo over ssh
npm i --save git+ssh://git#github.com:<owner>/<repo>
You can add these style repo URL's to your package.json dependencies as well
"dependencies": {
"custom-pkg": "git+https://[org].visualstudio.com/_git/[repo]"
}
You can read more about the different ways to install directly from git with npm in the npm install docs
If you want to install a specific branch, you can run:
npm install git+https://[org]#dev.azure.com/[org]/Products/_git/[repo]#[branch]
I'd like to install node modules from our gitlab server. This is a link to a repository:
http://ABCD-GITLAB/myGroup/myNodeModule.git
According to the npm install guide the install command should be this:
gitlabUser: me
myProject: myNodeModule
npm install gitlab:mygitlabuser/myproject
I have no idea how to reference my
gitlab server url
group
project
account name
I tried some commands but all failed:
npm install gitlab:ABCD-GITLAB:me/myproject
npm install gitlab:ABCD-GITLAB:me/myproject.git
npm install gitlab:http://ABCD-GITLAB:me/myproject
npm install gitlab:http://ABCD-GITLAB:me/myproject.git
npm install gitlab:http://ABCD-GITLAB:me/myGroup/myproject
npm install gitlab:http://ABCD-GITLAB:me/myGroup/myproject.git
npm install gitlab:http://ABCD-GITLAB:me/myGroup/myproject.git
What is the correct way to reference a npm dependency, a clear structure would be great like
npm install gitlab:<serverUrl/>:<username/>/<groupname/>/<projectname/><gitsuffix>.git
I would try one of these:
npm install git+ssh://git#ABCD-GITLAB:myGroup/myNodeModule.git
npm install git+https://git#ABCD-GITLAB/myGroup/myNodeModule.git
npm install git://ABCD-GITLAB/myGroup/myNodeModule.git
You may need to change git to your username and you can add #v1.0.27 or something like that at the end for a specific version or tag:
npm install git://ABCD-GITLAB/myGroup/myNodeModule.git#v1.0.27
You can also install from a tarball:
npm install https://ABCD-GITLAB:myGroup/myNodeModule/repository/archive.tar.gz
You can add ?ref=master to the end of the tarball URL for the branch.
I had install Node.js 4.2.2
i am trying to install socket.io package using npm install socket.io
but the npm installer just keep running with no error output in console after 30min..
Try to install some another package, mongoose for example. If it also fails try to reinstall npm by
npm install -g npm
Try the following:
npm install -g npm
npm cache clean
npm install socket.io
Also check if you permission to create node_modules folder in the directory you run npm.
You can downgrade your nodejs to v.4.2.1 for example, don't forget to clean npm cache after that, and then run npm install command.
First try to remove these packages and then install. Like
npm remove socket.io
Then
npm install socket.io
may be the incomplete installed files are blocking it to install properly
You need to update your npm anyway.
Try from link install:
curl -L https://www.npmjs.com/install.sh | sh
Or you can compile it with make if you clone sources from github
npm install downloads packages from npmjs.org, compiles and then installs. So even if the node_modules folder is taken backup it can not be used on other machines where the os might be different, due to the native machine code generated during the npm install.
Also another problem with npm install is that it downloads from npmjs.org. What if the site goes down?. How to download the packages and the same package be installed offline on all platforms?
You can tell npm to use a mirror if npmjs.org is down. For example:
npm set registry http://registry.npmjs.eu/
Or with a runtime option:
npm --registry http://registry.npmjs.eu/ install express
If you do keep the node_modules directory with your code, you can simply run npm rebuild to re-compile anything that needs it.
Otherwise, you have a lot of options for installing from various locations. You could keep package tarballs locally. From the documentation:
npm install (with no args in a package dir)
npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install [#<scope>/]<name> [--save|--save-dev|--save-optional] [--save-exact]
npm install [#<scope>/]<name>#<tag>
npm install [#<scope>/]<name>#<version>
npm install [#<scope>/]<name>#<version range>
npm i (with any of the previous argument usage)