npm publish executes but npmjs repository not receiving the update - node.js

I have tried publishing the following repository 3 times and each time npm indicates that it's successful, however I can't pull the the project into other projects using npm i superflycss/utilities-colors#3.0.5 and https://www.npmjs.com/package/#superflycss/utilities-colors is still stuck on version 2.1.6.
Any ideas what the issue could be?

You do not have any tags in your github repo. npm has a command to update the version info. See the docs: https://docs.npmjs.com/getting-started/publishing-npm-packages#how-to-update-a-package
Or you can tag manually with these commands in your shell:
git tag 3.0.5
git push --tags

Related

Npm install doesn't download dependency assets from Git LFS on Ubuntu

Background
I have a project that's split into several smaller projects with one main project that downloads the others as dependencies of the main project.
I'm using Gitlab to host my projects in private repositories, using deploy tokens to allow npm install to download them.
The dependencies are added to the main project using the following format in package.json:
git+https://name:token#gitlab.com/group/project.git
Problem
On Windows when I do a git clone of my main project and run npm install, it does download all the assets using Git LFS, but on Ubuntu the assets aren't getting downloaded. If I check the contents of all the files tracked by Git LFS all I get is the information Git LFS placeholder. I'm using identical commands and software versions on Windows and Ubuntu, but with different results.
I've tried:
Updating to same versions of Node(10.16.0) and Npm(6.10.2) on both Windows and Ubuntu
Updating to the latest versions of Node and Npm (I had to stick to version 10.x for Node because of some dependencies not working with 12.x)
Adding a .lfsconfig file that points to the repository as described in the following issue: https://github.com/npm/npm/issues/11151
Updating Git to the latest version (2.21 on Windows and 2.22 on Ubuntu)
Current workaround
Currently I'm cloning the main project then manually cloning my dependencies into node_modules so that they're all proper git repositories so that I can then use git lfs pull in them. It works, but it's not how it should work, especially not since it's working as it should on Windows.
Question
Why is npm install handling Git LFS differently for dependencies on Ubuntu vs Windows? How do I get npm install to work properly with Git LFS on dependencies, is there a settings somewhere I need to change to e.g. enforce Git LFS downloading?
Step 1. Inside of your repository, run the following command and then commit the resulting .gitconfig and push:
$ git config -f .gitconfig lfs.url https://gitlab.com/group/project.git/info/lfs
Step 2. In the directory in which you want to npm install your project, run for example:
$ npm install -S https://gitlab.com/group/project.git

NPM Authentication Error To Private Repo on jenkins build

I'm working on a Front End Application that relies on a dependency developed by our organization but is hosted in a separate repository. It's a bitbucket repo hosted by us and is private.
We're using NPM to manage this dependency, and install it via git+https://<the-dependency-repo>.com
This works in our local environment because our credentials are cached. Please note: WE CANNOT SWITCH TO SSH. I'm aware of the ssh solution, I have no control over account management, bitbucket access etc...
When the Jenkins CI runs, it pulls our application from it's repository using credentials stored in the Credentials Plugin, and runs npm install.
The Problem:
The install fails because of authentication failure during the npm install.
What I've tried so far:
Since the git credentials are stored in the Jenkins Credential Plugin, I have access to a git username/password combination.
The precise failure happens when npm attempts to run git ls-remote ...
To circumvent this authentication failure, I am able to run a shell command before the npm install:
git config credential.helper 'cache'
git fetch https://${USERPASSCOMBO}#<repo>
The good news is that this works! NPM is able to run git fetch ls-remote without error
The bad news is that the next command git clone -q <repo> fails.
I've attempted the same solution: adding the following prior to npm install:
git config credential.helper 'cache'
git ls-remote https://${USERPASSCOMBO}#<repo>
git clone https://${USERPASSCOMBO}#<repo>
note: these commands work as expected, prior to npm install
NPM install still fails however, producing the following error output:
[ERROR] npm ERR! Command failed: /bin/git clone -q https://<repo> /var/lib/jenkins/.npm/_cacache/tmp/git-clone-ed5ac1a9
[ERROR] npm ERR! warning: templates not found /tmp/pacote-git-template-tmp/git-clone-49feabe4
[ERROR] npm ERR! fatal: Authentication failed for '<repo>'
[ERROR] npm ERR!
Any help is greatly appreciated, even a pointer towards the right direction. I've exhausted trying everything I can think of.
Try installing from the repository with the URL git+https://user:password#<repo-url>.
Note that this leaves your password out in the open, so I suggest generating an app token or similar if your repository provider supports this.

npm & git - Generating artifacts on commit

I see a lot of npm modules that require a build/compilation step have a dist/ folder in their repo. Do the authors run the build step before committing manually or is this automated on commit, if so how?
Example repos:
https://github.com/se-panfilov/vue-notifications
https://github.com/ratiw/vuetable-2
https://github.com/hilongjw/vue-progressbar
Is it common to run the build step manually before a commit? How is this enforced?
The build step is usually not part of a commit but rather before publishing to npm. This can be automated in different ways, for example in a prepublish script.
There are several ways to do this:
Manually run the build commands, commit to git, and also publish to npm.
Commit to git, a CI server picks it up, builds and publishes to npm.
Use git hooks to build before each commit.
Add the build commands to postInstall step in package.json, this builds the module after a user has npm installed it.

Meteor npm start not working (Rocket.Chat)

I just cloned Rocket.Chat code and remove the .git from cloned code and init my git and pushed in my repository. But when I am trying to clone it somewhere else from my repository and trying to start the Rocket.Chat, it is giving following error. I am using latest versions of node and npm. Please help.
I found the issue. In current Rocket.Chat ".gitignore" file they put "build.sh" in ignore file list. And when we remove their git and add our git then the same named file on path "Rocket.Chat/packages/rocketchat-livechat/plugin" get ignored from commit. And Rocket.Chat is using that file when we run the "meteor npm start".
Try to run meteor npm install before running with meteor run.

Incrementing NPM/Grunt version on successful build -- Bamboo

I have a Bamboo server that is currently setup to test my builds on my project.
I want to start versioning my project using NPM version or grunt bump.
Here is the current Bamboo setup I have,
Bamboo detects repo change
Runs all the test
If the branch is the 'master' branch, then do a post job of moving our production code into an artifactory (we just zip up the appropriate files and drop them into it).
I would like to be able to increment the version between step 2 and 3 if the branch is 'master'.
I'm trying to come up with a good solution for this.
I'm wondering if something like just doing npm version or npm bump is enough? It seems that I would want to them commit that back to the git repo?
Looking for some possible suggestions
First detect that you're on the master branch. If so, do an npm version update. You also need to tell git to push to the remote repository rather than to the repo cached on the Bamboo server. For example, in a script task on your build plan:
npm install
npm run build
if [[ "${bamboo.planRepository.branchName}" == "master" ]]; then
# configure git to use the remote repo
git remote set-url origin ${bamboo.planRepository.1.repositoryUrl}
rm .git/objects/info/alternates
git fetch
# update the local version
# this will increment the last version number, commit and tag the commit
npm version patch
# create your artifact
npm pack
# push the version update
git push
git push --tags
fi

Resources