HEROKU: Logging in with another Heroku accnt and deploying fails my build - express

UPDATE:
I removed the warning by switching bcrypt versions V3 with V1.03. BUT now my passwords don't work. I assume it's because of the different hashing between both versions.
I created a personal Heroku account and uploaded my MERN project without a problem. I then created a 2nd Heroku accnt for work.
I then heroku logout and heroku login with the new account. I then tried uploading the same project with no changes, but keep getting
bcrypt#3.0.2 install /tmp/build_c823e78c1ca132209f395f59cc6e1071/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
// lots of node-pre-gyp ERR! code before finishing with
gyp ERR! cwd /tmp/build_c823e78c1ca132209f395f59cc6e1071/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.2 install script.
Node v8.12.0
NPM 6.4.1
Git version 2.17.1 (Apple Git-112)
macOS Mojave V 10.14

I use bcrypt 3.0.2 and ran into a similar issue today. Locally I am using Node version 10.11.0, but because I haven't specified it in the package.json, Heroku took a default Node version 8.XX.XX. I set it explicitly for Heroku as the same version as I use locally in my package.json file and then it worked.
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"engines": {
"node": "10.11.0"
},
"scripts": {
...

Related

How do you install Firebase tools in a Gitlab CI Runner?

I'm having some trouble configuring Gitlab CI to run firebase emulators. In particular, it's failing to install firebase-tools. This is the relevant part of my config
unit-test-job: # This job runs in the test stage.
image: node:14.14.0
artifacts:
paths:
- "test-results.xml"
reports:
junit: "test-results.xml"
stage: test
script:
- apt-get update && apt-get install -y openjdk-8-jdk
- npm i
- npm i -g firebase-tools
- firebase use $MY_PROJECT
- echo "Running unit tests..."
- npm run test:ci
When trying to install firebase-tools I get this error from the CI
$ npm i -g firebase-tools
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
> re2#1.16.0 install /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR || npm run rebuild
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.br ...
Writing to build/Release/re2.node ...
Trying https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.gz ...
Writing to build/Release/re2.node ...
Building locally ...
npm ERR! code EACCES
npm ERR! syscall scandir
npm ERR! path /root/.npm/_logs
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 65534:0 "/root/.npm"
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
> re2#1.16.0 rebuild /usr/local/lib/node_modules/firebase-tools/node_modules/re2
> node-gyp rebuild
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.14.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/re2/.node-gyp'
gyp ERR! System Linux 5.4.109+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/firebase-tools/node_modules/re2
gyp ERR! node -v v14.14.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! re2#1.16.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the re2#1.16.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any suggestions on how to fix this?
You're actually encountering an issue that isn't necessarily related to gitlab-ci, but it actually related to node 14. Essentially that /root/.npm folder has bad permissions in node 14. You have three ways you can fix this:
Update to Node 15 (just change your image to node:15) which fixes the permission issue
Allow node permissions to scan the folder. This is insinuated by the error message you have in the above error where it tells you the directory can't be scanned. The easiest way to resolve this issue is to remove the -g off the second node install, which will make it deploy to the user folder instead of global. Since you're rebuilding the container every time and using the same user each time, the -g to install globally is redundant in this case.
Install Firebase using the standalone method to get the CLI instead of using NPM to install it. You can do this in a docker container using curl -sL firebase.tools | sed 's/sudo //g' | bash
Hopefully this helps!

installation of Bower : getting npm ERR

I have node and nodenv installed on my Ubuntu 16.04
I want to install bower
npm install -g bower
I am getting this :
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop
working at any moment because its dependencies can change. Prevent
this by migrating to Yarn:
https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm ERR! Linux 4.4.0-94-generic
npm ERR! argv "/home/mypc/.nodenv/versions/4.6.0/bin/node" "/home/mypc/.nodenv/versions/4.6.0/bin/npm" "install" "-g"
"bower"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR! Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
npm ERR! Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
npm ERR! From: https://registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues>
The npm client is unable to verify the downloaded file from the npm registry:
shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
How to fix?
If you have a corporate proxy in between, make sure it doesn't modify the content of your downloaded files.
If there is no proxy involved, retry the installation.

How to install eslint-airbnb?

when i run
(
export PKG=eslint-config-airbnb;
npm info "$PKG#latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /#/g' | xargs npm install --save-dev "$PKG#latest"
) successfully. eslint --init and run the script in package.json.
Info : my Node node v7.5.0 npm 4.1.2
there is problem below.
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/next/.nvm/versions/node/v7.5.0/bin/node"
/Users/next/.nvm/versions/node/v7.5.0/bin/npm" "run" "lint"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! beslint#1.0.0 lint: `eslint app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beslint#1.0.0 lint script 'eslint app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the beslint package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs beslint
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls beslint
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/next/es6/jsmodules/beslint/npm-debug.log
Are you sure that running eslint --init worked ?
This is like you have no .eslintrc file (the configuration file for ESLint parser options and rules). Check/create the .eslintrcfile at the root directory of your project that you called "beslint".
Then you'll need to add this in the .eslintrcfile in order that ESLint take into account that you want to extend the rules from the Airbnb team:
{
"extends": "airbnb"
}
Note that you can install different rules from the Airbnb team:
"airbnb": Airbnb ESLint rules, including ECMAScript 6+ and React
"airbnb-base": Airbnb ESLint rules, including ECMAScript 6+
"airbnb-base/legacy": Airbnb ESLint rules, including ECMAScript 5 and below
The extends value in your .eslintrc file should match your installation and be one of these three previous values.
I made a little command line tool that can install ESLint with one of these three different Airbnb configs. It automatically creates and configure the .eslintrc file if it has not already been done. It helps me a lot on my personal projects and at work! It's called esbnb. Hope it could help you.

No compatible version found: grunt-contrib-concat#'node_modules/grunt-contrib-concat'

I recently received website that consists of an index.html, sass files, javascript files and a few configuration files. I tried to run the command npm install in the main project directory and I got the following error.
npm ERR! Error: No compatible version found: grunt-contrib-concat#'node_modules/grunt-contrib-concat'
npm ERR! Valid install targets:
npm ERR! ["0.1.0","0.1.1","0.1.2","0.1.3","0.2.0","0.3.0","0.4.0","0.5.0","0.5.1","1.0.0","1.0.1","0.1.2-rc5","0.1.2-rc6"]
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:719:10)
npm ERR! at /usr/share/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 4.4.0-x86_64-linode63
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/project.com/public_html_staging
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/project.com/public_html_staging/npm-debug.log
npm ERR! not ok code 0
This is what my package.json looks like
{
"name": "project",
"version": "0.0.0",
"devDependencies": {
"glob": "~4.3.1",
"grunt": "~0.4.1",
"grunt-autoprefixer": "~2.0.0",
"grunt-concat-css": "^0.3.1",
"grunt-contrib-concat": "node_modules/grunt-contrib-concat",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-cssmin": "~0.11.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-sass": "~0.8.1",
"grunt-contrib-uglify": "~0.7.0",
"grunt-contrib-watch": "~0.6.1"
},
"dependencies": {
"load-grunt-tasks": "~2.0.0"
}
}
I'm really new to the npm command and any related subject matter. How do I begin to troubleshoot this error? Or does anyone know the solution?
The problem was caused by the fact that I was using NodeJS version 0.1 while the project was originally built on a server that had NodeJS v5. Hence the npm didn't have all the right grunt dependencies.
I did the following as root user on my affected server
apt-get purge nodejs
apt-get purge npm
apt-get autoremove // remove any orphan dependences
Once I got rid of everything, I install version 6 of NodeJS as per the nodejs website with these commands:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
The NodeJS already came with it's own npm, so I didn't need to do anything else.
Then when I ran npm install, it properly downloaded all the necessary modules to run my project.

How to Fix Error "user admin is not allowed to access package"

I am updated now and running
node v5.0.0
npm v3.3.6
On a Mac (El Capitan)
When i run "npm install" on my project now. I get errors like this:
me:controls me$ sudo npm install
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/0.10.36/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code E403
npm ERR! user admin is not allowed to access package chai : chai
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/Dev/controls/npm-debug.log
Im not seeing any solutions to this around the web yet? I tried both sudo and not sudo and makes no difference.
Any suggestions?
I had the same problem. Check the registry: npm config list.
Try to run:
npm set registry "https://registry.npmjs.org/"
and then npm i again.
I used sinopia as a registry. Sinopia can't work with scoped packages.