How to add public bitbucket repo in package.json or bower.json - npm

I have a library pushed on bitbucket as public repo. I want its link to used in package.json dependencies object. I have tried various https formats but not one is working.
"library_name": "https://username#bitbucket.org/repo_name.git"
"library_name": bitbucket://bitbucket.com/username/repo_name.git
"library_name": "bitbucket#bitbucket.com:username/repo_name.git#master
Or I can add it in bower.json? I don't want to use it directly like npm install repo_url
The error I get is something like
ECMDERR Failed to execute "git ls-remote --tags --heads https://username#bitbucket.org/dv.keystone.git", exit code of #128 remote: Not Found fatal: unable to access 'https://username#bitbucket.org/reponame.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
remote: Not Found
fatal: unable to access 'https://username#bitbucket.org/repo_name.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Update:
"lib_name": "https://username#bitbucket.org/team_name/repo_name.git"
It works in bower.json but I need this in package.json to work. If I use it in package.json, it gives this error
npm ERR! addLocal Could not install /tmp/npm-16628-b0121d64/git-cache-cbc9eb1e/7c4c6a5fb3e77723f3866c99fdf0825ba7cc0c5c
npm ERR! Linux 4.13.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.12.3
npm ERR! npm v3.10.10
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

Did some googling for you - as I wasn't sure myself.
This may work for you:
git+https://bitbucket.org/{user}/{repo}.git

I do not know how to add BitBucket modules in package.json. The way I do add github repo as,
"library-name": "git+https://github.com/user/library-name.git"
So to think about just replacing the github part it should be
"library-name": "git+https://bitbucket.org/user/library-name.git"

Related

Error when updating my dependencies in React

I just added some code to my dependencies list in my package.json file. I ran NPM update --save and I am getting this error
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git#github.com/process/browser.git
npm ERR! git#github.com: Permission denied (publickey).npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! A complete log of this run can be found in:

Failed to install puppeteer using npm - connect EACCES

When I try to run a npm install, it fails at a dependency called puppeteer.
And if I run:
npm install -g puppeteer#1.5.0
(existing in package.json as "puppeteer": "1.5.0",) it fails with the following error:
npm ERR! code EACCES
npm ERR! errno EACCES
npm ERR! FetchError: request to http://registry.npmjs.org/puppeteer failed, reason: connect EACCES 104.16.27.35:80
npm ERR! at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:182:13)
npm ERR! at Socket.socketErrorListener (_http_client.js:391:9)
npm ERR! at Socket.emit (events.js:182:13)
npm ERR! at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR! at process._tickCallback (internal/process/next_tick.js:63:19)
but I can access that URL (http://registry.npmjs.org/puppeteer) using my browser.
The other dependencies specified in package.json work fine. Only this one generates problems.
Details:
npm - 6.2.0
node - v10.9.0
OS: Windows
Any suggestions?
npm ERR! code EACCES
npm ERR! errno EACCES
This is a permission error, on a normal day, I will say you should just use sudo npm install -g puppeteer#1.5.0, but I will suggest you reclaim ownership of the .npm directory by running this:
sudo chown -R $(whoami) ~/.npm
Then you need the write permission in node_modules directory:
sudo chown -R $(whoami) /usr/lib/node_modules
after which you can run your npm install -g puppeteer#1.5.0, This should solve your issue.
UPDATE:
I will suggest two other options for you,
from your terminal, run this:
npm config set unsafe-perm=true
OR
use yarn add for your installation.
also sometimes it just takes a while; I used npm install (I'm trying to use formkit but I'm not sure if it matters) --verbose and I'm getting a bunch of
npm http fetch GET 200 https://registry.npmjs.org/#formkit%2fvalidation
70085ms (cache stale)
so I assume its some issue that requires me to download things that take a very long time. Maybe an issue connecting to the verification server?
Edit: restarted computer, cleared cache, etc etc. Still weird and slow.
Not sure what happened but fixed it by going into my IDE (Jetbrains WebStorm) and changing my package handler in settings to a different nodejs. The one I was using was in Program Files and was having trouble accessing pieces in AppData/Roaming, There was another installation inside AppData and picking that one automatically solved my permissions issue.

Private modules npm install error

After npm install in project local directory I've got log with error like this
npm ERR! code ENOLOCAL
npm ERR! Could not install from "..{path}" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/home/.npm/_logs/2018-06-28T11_13_56_437Z-debug.log
How I can resolve this problem? (the best way without deleting node-modules)

Stencil CLI Installation Hiccup

Ran into a small hiccup when attempting to install the stencil CLI on my machine running Ubuntu 14.04. I will attach the contents of the error below. At this point, I've been able to verify that npm, and node are installed correctly and I've been able to verify that I have the correct GitHub permissions by confirming my ability to access https://github.com/bigcommerce-stencil/stencil-cli. Any insight would be appreciated.
dante#Ubuntu:~$ sudo npm install -g bigcommerce-stencil/stencil-cli
[sudo] password for dante:
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Cloning into bare repository '/home/dante/.npm/_git-remotes/git-github-com-bigcommerce-stencil-stencil-cli-12bc62b4'...
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Permission denied (publickey).
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli fatal: Could not read from remote repository.
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Please make sure you have the correct access rights
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli and the repository exists.
npm ERR! addLocal Could not install bigcommerce-stencil/stencil-cli
npm ERR! Error: ENOENT, stat 'bigcommerce-stencil/stencil-cli'
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 3.16.0-57-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bigcommerce-stencil/stencil-cli"
npm ERR! cwd /home/dante
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path bigcommerce-stencil/stencil-cli
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/dante/npm-debug.log
npm ERR! not ok code 0
I might also add that I've verified that npm is also installed on my machine as it is bundled w/ the node installation. I feel as if this is something that I'm easily overlooking.
This is due to the closed source code. You need to go through the early access dev flow and add your SSH keys, etc. Should resolve it.

Error installing Dalek JS Module - Chrome Browser

I'm having trouble installing the Chrome Browser Dalek JS Module.
Here's an extract from the console output:
npm http 304 https://registry.npmjs.org/abbrev
> dalek-browser-chrome#0.0.2 install /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome
> node install.js
Chromedriver installation failed Error: EACCES, permission denied '/Users/xxx/tmp/chromedriver'
at Object.fs.unlinkSync (fs.js:582:18)
at rimrafSync (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/rimraf/rimraf.js:154:8)
at Promise._successFn (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:176:7)
at Promise._withInput (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:204:25)
at Promise._chainPromise (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:244:13)
at Promise.then (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/kew/kew.js:144:13)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/install.js:175:23
at loadCbs.length (/Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:76:7)
at Array.forEach (native)
at /Users/xxx/Sites/tests/node_modules/dalek-browser-chrome/node_modules/npmconf/npmconf.js:75:13
npm ERR! dalek-browser-chrome#0.0.2 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the dalek-browser-chrome#0.0.2 install script.
npm ERR! This is most likely a problem with the dalek-browser-chrome package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls dalek-browser-chrome
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
i'm running Mac OS X 10.8.4. it looks like a permissions issue, but i'm running the install as follows:
sudo npm install dalek-browser-chrome --save-dev
UPDATE
I did try running this without sudo first - but got the following:
── ncp#0.4.2
├── kew#0.1.7
├── q#0.9.6
├── adm-zip#0.4.3
├── rimraf#2.2.2 (graceful-fs#2.0.0)
└── npmconf#0.1.2 (once#1.1.1, inherits#2.0.1, osenv#0.0.3, ini#1.1.0, mkdirp#0.3.5, semver#2.1.0, nopt#2.1.2, config-chain#1.1.7)
npm ERR! Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR! { [Error: EACCES, open '/Users/xxx/Sites/tests/package.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/Sites/tests/package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "dalek-browser-chrome" "--save-dev"
npm ERR! cwd /Users/xxx/Sites/tests
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! path /Users/xxx/Sites/tests/package.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/xxx/Sites/tests/package.json'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/xxx/Sites/tests/npm-debug.log
npm ERR! not ok code 0
Based on this I tried it with Sudo.
Any idea what else it might be?
The chromedriver module is attempting to run an install script that touches files outside of the module's directory.
This is a bug with the chromedriver module. It should not be trying to touch any files outside of its module folder at install time. If this is absolutely necessary, it can ask for permission from you at run time and do what it needs to do.
In order to prevent surprising exploits, npm runs package lifecycle scripts as nobody when you are running npm as root. The nobody user doesn't have permission to write to /Users/xxx/tmp (weird username you've chosen, btw), so the install script fails.
What if a package were to write to /etc/hosts or something, and add a bunch of phishing site IP addresses as the location for various bank websites? If you download a command, and then run it, and it does some bad stuff, ok, you screwed up and trusted the wrong program. But if simply installing the program does some bad stuff like this, then npm has violated your trust, and I try not to let that happen.
You could argue that you've explicitly asked to download the program, but since the web of trust with small dependencies can get very wide, it's just a bit too dangerous for me to sleep well at night, so that's why npm has this rule.
The problem could be related with the use of sudo,
the module is a local one, so you should be able to install it without the use of sudo.
After the chromedriver executable is downloaded, the installer tries to fix the permissions of the downloaded file, which might result in this problem.
Further read on to sudo or not: http://howtonode.org/introduction-to-npm