I'm not seeing update-to-date responses from Gemfury about package versions the way I'd assume I would. I've got my ~/.npmrc file configured with:
registry=https://npm-proxy.fury.io/MyaPiTokEn/myaccountname/
and I'm logged in with npm login. I know some things work because I can do things like:
npm install my-private-package
and my-private-package exists only on Gemfury. When I run npm outdated, however, I do not get any response about a package I have put into Gemfury even though the package's version shows in the Gemfury UI as 1.0.4, the version in my app's "node_modules" directory is 1.0.3, and my app's "package.json" file has a dependency with "^1.0.2".
In fact, in order to update my app after I update the Gemfury repo via a git push, I have to actually delete the package directory from my app's "node_modules" directory and then run npm update.
If I do that, I'll pull the very latest 1.X.X version as my package.json specifies. If I don't delete the package directory first, no update will happen. Is there something misconfigured that comes to mind, or does npm-proxy.fury.io not support the queries my npm CLI is sending?
Related
There's a public tool (csso-cli) that can be installed with npm install -g csso-cli to be available globally. Now I need to make a modification to it and change one of its dependencies (csso) to a newer version to use the latest features. So I cloned the repository and installed that with npm install -g ./. It did copy that local code directory to my global npm installation location, but none of the required dependencies were added. There simply isn't a node_modules subdirectory in the install location.
How can I properly install an npm package from a local directory, including all external dependencies, as if it were installed from a public repository? Maybe I need to create some sort of package file first and install that? I don't know much about npm. I searched the web but couldn't find anything. (All instructions are missing the dependencies.) I've read the npm documentation but am still no wiser. That topic isn't covered here, still only incomplete installations without dependencies seem possible. Who needs that?
Looks like I needed the npm pack command. It creates an archive of the package from the local directory. When installing that file with npm install -g my-package-1.0.0.tgz all dependencies are properly installed as well. Plus, the package file doesn't contain the git files.
I'm developing an Angular application and until now I have been using the default npm repository (registry.npmjs.org). Now I need to switch to using Artifactory and update my project accordingly.
I already changed the registry with:
npm config set registry (myArtifactoryRemoteRepoURL)
Then, after deleting the nodes_module folder I ran the npm install command:
npm i
I also tried:
npm i --package-lock
The modules are still loaded from the default npmjs registry. I guess this is because in the package-lock.json the dependencies are still resolved to default repo URLs. So I would probably have to update the package-lock.json somehow.
You can delete the package-lock.json file entirely (and the node_modules as well). Those will be regenerated when you run npm install.
I have a simple question that i cant seem to find the answer for. I cloned a git repo to my local machine.
When attempting to start node, I receive an error because i don't have the required npm dependencies installed. However, they are located in the packages.json file that was cloned.
I was wondering if there was a simple way to install the dependencies located in that file, without having to npm install for every individual package.
Within the directory of the package.json file, just run npm install. It will read package.json and install all dependencies. If you want to limit it to only non-dev dependencies, use npm install --only=production.
The node module that I need has been updated, and there is an old version of it installed on the gitlab project. Is it possible to get the folder for that specific module as it is when it was installed?
Thank you
You dont't want to keep source code of external dependencies in your repo. You should add your node_modules to .gitignore and remove it from the repo. Instead, you just track your dependencies in your package.json file by installing them via npm install --save. Then, when someone checks out your project, he just runs npm install and all dependencies get resolved automatically. If you want to update any of the dependencies, you update it via npm cli, and commit the updated package.json to your repo.
The problem drove me crazy, there is a package in npm database, but it has some bugs, which are already fixed in github, how could I make use of the fixed version(github version)?
Edit:
You can install directly from the GitHub repository, even just using the GitHub username and the repository name:
npm install LearnBoost/socket.io
You can also add a <commit-ish>, specifying e.g. a commit hash or a version tag, like so:
npm install LearnBoost/socket.io#1.7.x
Without a protocol, this will be interpreted as git://github.com/LearnBoost/socket.io. You can also prefix the repo with gitlab:, gist: or bitbucket:, respectively. For more information, see Using git URLs as dependencies.
You can install directly from a URL, example:
npm install https://github.com/LearnBoost/socket.io/tarball/master
You can find the URL on Github under "Downloads" on any project page. Select the "Download as tar.gz" link.
Or you can install a tarball:
npm install foo.tar.gz
See npm install(1).
Edit:
I should mention that this works equally well in package.json files. Specify the URL instead of the version in your dependencies, like so:
...
"dependencies": {
"foo": "http://example.com/foo.tar.gz",
"bar": "1.2.x",
...
}
Other temporary solution, get the github project and use npm link (http://npmjs.org/doc/link.html) to link the local folder obtained through git to your node_modules folder in your own project. Anyway in the end, you'll have to wait for the project maintainer to do a npm publish.
Either add the module as a git sub-module (using git submodule) to your project or tell the module maintainer to update the version and trigger a npm publish to update the npm repository.
When using the sub-module way, be aware that you cannot update the reference using npm-commands.