"npm install <github url>" Downloading from NPM instead of GitHub - javascript

So I am trying to install a package from GitHub, but for some reason npm install is pulling a different package (which has the same name) from NPM, instead of GitHub.
When I run npm install git+https://github.com/wojtekmaj/react-daterange-picker, it for some reason installs the package https://github.com/onefinestay/react-daterange-picker. This happens even if I manually insert the GitHub package url into my package.json dependancies, and then run npm install.
I have even tried deleting all my cache, and even deleting /node_modules/ and package-lock.json and reinstalling via the command rm -rf node_modules package-lock.json && npm install.
Any ideas why npm install is pulling from NPM instead of GitHub?

If I understand you correctly you do rm -rf node_modules package-lock.json && npm install before trying your command. But this will install everything according to package.json and recreate package-lock.json. So when you do your modified command it won't work.
I think the best way is to:
rm -rf package-lock.json node_modules
Modify your package.json to use the correct git+https link
npm install

Related

if i deleted my project but i have that in my github so did i have to re install all the dependencies again or just run npm install?

My question is if i deleted my project but i have that in my github so did i have to re install all the dependencies again or just run npm install? i formeted my pc so i project lost away but before formet i uploaded my project on github so do i have to download all dependencies again or just run npm install? i have dependencies of nodejs react native and choco socketio and some more so that i can do downlaod everthing again or just npm install and all dependencies will be install by npm
once you run git clone [REPO_URL] if all dependencies are listed in package.json then running npm install in cloned project directory will install all dependencies

NPM Module Not Found - Puppeteer

I can't install Puppeteer. I get the same error if I do npm install.
This could be a few problems and would need to know more about your project setup to really help but here are my theories.
It would seem you do not have a package.json in that location, so npm is unable to download and build a node_modules with the puppeteer package. Try running this first:
npm init -y
npm install --save puppeteer
The -y just auto accepts a default npm setup. Then you can run:
Or if you do already have a node_modules and npm initialized, I would try:
rm -rf node_modules
npm install
Lastly, if you are looking to run this globally you should be installing this with
npm install -g puppeteer
If all of those don't work a good bet would be to reinstall Node and try again.
Also, check out the new version of puppeteer built by the same devs but at Microsoft! Playwright

How to install npm package from downloaded folder

I used to install an npm project from github by doing
git clone http...my_project
npm install my_project
Instead of copying the contents of my_project to my local node_modules folder, it actually created a symlink from node_modules/my_project to my_project, then I could modify everything on my git cloned folder and it'd be on my project.
I believe this behavior changed in newer versions because it won't create the symlink anymore. It just copies the folder to node_modules
Is there a way to do it again?
Try this:
npm install "file:your/module/path" --save
Instead of running:
git clone http...my_project
npm install my_project
Use this:
git clone http...my_project
cd my_project
npm install

After installation of Gulp: “no command 'gulp' found”

After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ directory, I can see the gulp executable there.
Is there something wrong with my npm installation?
That's perfectly normal.
If you want gulp-cli available on the command line, you need to install it globally.
npm install --global gulp-cli
See the install instruction.
Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).
So you could add scripts to your package.json file:
{
"name": "your-app",
"version": "0.0.1",
"scripts": {
"gulp": "gulp",
"minify": "gulp minify"
}
}
You could then run npm run gulp or npm run minify to launch gulp tasks.
I solved the issue without reinstalling node using the commands below:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
I actually have the same issue.
This link is probably my best guess:
nodejs vs node on ubuntu 12.04
I did that to resolve my problem:
sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
I solved the issue removing gulp and installing gulp-cli again:
rm /usr/local/bin/gulp
npm install -g gulp-cli
if still not resolved try adding this to your package.js scripts
"scripts": { "gulp": "gulp" },
and run npm run gulp
it will runt gulp scripts from gulpfile.js
Installing on a Mac - Sierra - After numerous failed attempts to install and run gulp globally via the command line using several different instructions I found I added this to my path and it worked:
export PATH=/usr/local/Cellar/node/7.6.0/libexec/npm/bin/:$PATH
I got that path from the text output when installing gulp.
Tried with sudo and it worked !!
sudo npm install --global gulp-cli
I'm on lubuntu 19.10
I've used combination of previous answers, and didn't tweak the $PATH.
npm uninstall --global gulp gulp-cli
This removes any package if they are already there.
sudo npm install --global gulp-cli Reinstall it as root user.
If you want to do copy and paste
npm uninstall --global gulp gulp-cli && sudo npm install --global gulp-cli
should work
I guess --global is unnecessary here as it's installed using sudo, but I've used it just in case.
in my case there was only on issue, just put "gulp":"gulp" in the script portion, of package.json, and then use command npm run gulp.

Bower will not install packages when .bowerrc exists

I'm trying to install packages using Bower.
Without a .bowerrc file, it works. For example, bower install angular#1.0.6 will install nicely inside ./bower_components.
If there is a .bowerrc with { 'directory' : 'public/javascripts/vendor' }, bower install angular#1.0.6 will not work. Actually, the output of that command is nothing. It simply prints a blank line, then the next line is my terminal prompt. The package is not installed anywhere.
However, if there is an empty .bowerrc file, it will install the package inside ./bower_components.
Why is it not installing the packages and how can I fix it? (so they will install)
Additional info:
No bower command works. bower will fail similarly. bower help too. In fact, bower anything will too.
I just solved this. I uninstalled and reinstalled bower, and now it works. :S
sudo npm rm -g bower
sudo npm install bower -g
Now everything works fine!
The solution here is simple :
Install Bower in your public directory ( Not your app/node master directory )
For example, mynodeapp/public - npm install bower
Then, set up bower from this directory : bower init
Create your .bowercc file, and add to it :
{
"directory" : "vendor"
}
//Where vendor is your custom fldr
Thats it. Now whenever you run a bower install command from within the public directory, it will either create or save to that "vendor" directory.
Everyone seems to have trouble because they are installing Bower outside their public folder.
Try to run with -f flag (force)
bower -f install
I think that you should be reinstall the bower
npm rm -g bower
npm install bower -g

Categories

Resources