Command not found after && - bash

Why this is not executing?
git clone app.git && cd app && npm install && bower install && gulp
output gulp: command not found
Either this
git clone app.git && cd app && npm install && bower install ; gulp
output gulp: command not found
But only
git clone app.git && cd app && npm install && bower install then gulp
Is there any way to execute gulp inside chain?
Please Note:
Gulp is already globally installed with npm install -g gulp
Running gulp in nonsense directory throws
[04:24:57] Local gulp not found in ~/dev/projects/repoint
[04:24:57] Try running: npm install gulp
Which means its installed globally installed.
For demo, please grab this repo and execute:
git clone https://github.com/vko-online/metro.git && cd metro && npm install && bower install && gulp

If the semi-colon variant doesn't work then gulp is not in your path, plain and simple. That's the problem you need to fix.
Fixing it may involve installing gulp or it may be as simple as modifying your path to include the directory where it's installed.

As pointed out in the doc, you should install it globally and add it to your project dev deps locally:
npm install gulp --save-dev

Related

Laravel 8, NPM Wepback API configuration problem, using Yarn on Ubuntu 20.04

Using npm run dev results in the error:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. configuration.module.rules[10] has an unknown property 'loaders'
Jetstream Version: 1.6
Jetstream Stack: Livewire
Laravel Version: 8.14
PHP Version: 7.3.0
Database Driver & Version: MySQL v8.0
Steps to reproduce:
Navigate to directory hosting Laravel 8 project
Run command rm -rf node_modules and wait for the command to complete
Run command rm package-lock.json
Run command npm cache clear --force
Run command sudo npm install --global npm - this updates NPM (Node Package Manager)
Run command sudo yarnpkg install
Run command sudo yarnpkg add babel#latest
Run command sudo yarnpkg add webpack#latest
Run command sudo yarnpkg add webpack-cli#latest
Run command sudo yarnpkg add vue-template-compiler --save-dev --production=false
Run command sudo yarnpkg add sass-loader#8.* sass --save-dev --production=false
Run command sudo npm install --global cross-env
Run command yarnpkg run dev
NPM is supposed to return a success message, but clearly something is either broken or misconfigured...
Problem has been solved through either an NPM or Yarn update

how to update npm on macOS

For reasons unknown to me, I haven't been able to update to the latest version of npm on macOS (it works fine on Windows). It displays no error, only 'updated 1 package'.
Using Node.js 8.11.1
node -v
v8.11.1
What version of npm do I have?
$ npm -v
5.6.0
I tried this...
$ npm i -g npm
+ npm#5.8.0
updated 1 package in 7.37s
And it fails to update.
$ npm -v
5.6.0
Where is npm?
$ which npm
/usr/local/bin/npm
So I try brew...
brew install npm
And it fails...
$ npm -v
5.6.0
*And then I tried this... *
npm install npm#latest -g
+ npm#5.8.0
updated 1 package in 7.618s
And it fails...
npm -v
5.6.0
With sudo:
sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.794s
And it fails...
npm -v
5.6.0
This also fails...
sudo npm install npm#latest -g
I followed the directions found on this Q&A, completely removing npm and node from my system and reinstalling them from scratch, and it also fails to update.
Screenshot, per request:
Close the terminal, and then re-open the terminal and running:
$ npm -v
5.6.0
sudo twice:
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.478s
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.434s
Also fails:
$ npm -v
5.6.0
What did I miss? What's going on here?
This works on my mac.
Based on docs https://docs.npmjs.com/troubleshooting/try-the-latest-stable-version-of-npm :
npm install -g npm#latest
There is a note stated on the docs that depends on your installation method, you might addd some sudo.
Upgrading on *nix (OSX, Linux, etc.)
(You may need to prefix these commands with sudo, especially on Linux,
or OS X if you installed Node using its default installer.)
npm install -g npm#latest
works fine!!
and you can also replace the latest for specific versions
like
npm install -g npm#5.6.0
I hope it will help!!!
Perhaps you have already solved this, but here is what I found when I had exactly this issue. I had 2 versions of npm installed.
I verified this as follows:
grep \"version\" ~/.npm-packages/lib/node_modules/npm/package.json
"version": "6.2.0"
grep \"version\" /usr/local/lib/node_modules/npm/package.json
"version": "5.6.0",
I worked around the issue by updating the path in my bash profile, but would like to know why (how) I ended up with 2 versions. Here is the update:
tail -2 ~/.bash_profile
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
In my case, none of the previous answers worked. For me, a working solution was a simple, five-step process.
Make sure (the old version of) npm is installed.
npm -v
If npm is not installed, then install it on the Mac with Node.js.
Globally installed the desired version of npm.
npm install -g npm#latest
This command uses the old version of npm (installed by Node), to globally install the latest version of npm at ~/.npm-global/. Once installed, close and open a new terminal shell.
Remove the old version of npm installed by Node
rm -r /usr/local/lib/node_modules/npm/
Sometimes this doesn't work, so I had to go into finder to delete the /npm/ folder.
Make sure to set the correct path variable.
echo $PATH
If ~/.npm-global/bin does not show up between the colons, then update the path variable. Open up ~/.zshrc in a text editor and add the following line. If you don't use zsh, open the profile for your corresponding shell (i.e. ~/.bash_profile)
export PATH=$PATH:$HOME/.npm-global/bin
Save your changes and close the text editor.
Close and reopen the terminal shell and run npm -v to check that npm is correctly on the latest version.
The reason for updating the path variable is because the npm cli suggests you update npm with npm install -g npm which will install npm at a different location than where Node installs npm originally.
In my case, only the following has helped:
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --ignore-dependencies node
brew install node
EDIT NOV 21: These days, I bypass brew entirely and use "n":
https://www.npmjs.com/package/n
And so I can change between versions too.
I faced the same problem.
You might have already installed the npm version, and now it is time to point the new npm version install. You can do that by following below steps.
sudo nano /usr/local/lib/node_modules/npm/package.json
change "version" : "5.6.0" to "verison": "5.8.0"
In my case, I'm using nvm to manage different versions of node. In order to upgrade npm version, I have to
1 - Install the latest version of npm by navigating to your current
version of node
cd ~/.nvm/versions/node/v10.9.0
npm install npm
or you can probably use
nvm install-latest-npm
2 - Edit $PATH to point to your current version of node
NPM_PACKAGES="${HOME}/.nvm/versions/node/v10.9.0"
PATH="$NPM_PACKAGES/bin:$PATH"
On my macOS the homebrew-installed npm did not want to upgrade due to pre-existing link file. I ran the install with --force flag and now things are okay.
$ npm --version
6.14.16
$ npm install -g npm#8
npm ERR! EEXIST: file already exists, symlink ...
$ npm install -g --force npm#8
npm WARN using --force I sure hope you know what you are doing.
+ npm#8.19.2
$ npm --version
8.19.2
Note also that in my case, no 'sudo' was required, thanks to homebrew. To check if your npm is installed with homebrew, use brew list.
$ brew list | grep node
node#12

'Error: not found: git' code: 'ENOGIT' while installing bower

I'm using windows 10 with git and node installed. Running :
npm install -g bower
resulsts in
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit sheerun/fs-write-stream-atomic#v1.0.4-fix resetting remote C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/sheerun/fs-write-stream-atomic.git C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7: undefined
....
You should try to run this command as root. On Windows, start your CommandLine as administrator and under Mac or Linux use
sudo npm install -g bower
Installing git and running npm install from git-bash worked for me. Make sure you are in the correct directory.
Refer more here for solution
git is not installed or not in the PATH
i use windows and i have same problem when i want to install react-native-router-flux , for me that is solved when i use git bash to install it instead of command line, i hopefully this is help you .

fine-uploader example traditional build

So, I'm trying to evaluate fine-uploader. I decided to go to the download page, but it wants you to purchase a license, but I don't want to do that until after I've evaluated it. So, I went to github and downloaded the master zip for it and unzipped. My question is now what? The so-called "step-by-step" are not step-by-step. Am I supposed to build something? The documentation states I just need to include one file....which file? In the demos, for traditional use, i see it includes fineuploader-{VERSION}.js, but I see no file that even starts with "fineuploader" in the subdirectory of "client/js/*".
Am I just missing the documentation for this completely?
Thanks!
Following Bjørn Børresen's answer, the official documentation (which is severely lacking) and some troubleshooting, I was successfull on Ubuntu 13.10 with the following commands:
sudo apt-get install npm git
sudo npm install -g npm
sudo npm install -g grunt-cli
sudo npm install -g bower
git clone https://github.com/Widen/fine-uploader.git
cd fine-uploader
npm install http://github.com/e-jigsaw/grunt/tarball/fix-underscore-string-version
bower install
sudo npm install -g
npm install grunt
npm install
grunt package
You'll need git, NPM, Grunt & Bower.
Assuming you have git, if not install it. Then navigate to http://nodejs.org/ and INSTALL NodeJS.
From the command line:
npm install -g grunt-cli
npm install -g bower
git clone git#github.com:Widen/fine-uploader.git
cd fine-uploader
bower install
npm install -g
grunt
These are the steps that worked for me on Windows 7:
I. Install Prereqs (should only be necessary the first time)
Install node.js on windows if you haven't already.
Ensure npm has been added to your PATH variable (as of this writing, node.js puts this in during install):
%USERPROFILE%\AppData\Roaming\npm
Install git on windows if you haven't already.
Ensure the git commands have been added to your PATH variable (as of this writing the git install does not add these):
C:\Program Files(x86)\Git\bin;C:\Program Files (x86)\Git\cmd
Open command prompt.
Install grunt globally:
npm install -g grunt
Install grunt-cli globally:
npm install -g grunt-cli
Clone the repo if you haven't already:
git clone git://github.com/Widen/fine-uploader
Change command prompt directory to repo location (most likely at %USERPROFILE%\fine-uploader).
Install dependencies (if you want the dependencies installed
globally add a -g below but it is not necessary):
npm install
II. Build and Package
Open command prompt at the repo location (i.e. %USERPROFILE%\fine-uploader)
Pull latest, if necessary:
git pull
package it up:
grunt package
This should result in the files being added to the _dist folder in your repo.
The build and distribution methods have changed quite a bit over the past couple years. As of Fine Uploader 5.11, you have the following options:
Download Fine Uploader from npm
npm install fine-uploader
Download Fine Uploader from the project's home page
...at http://fineuploader.com/customize
Build Fine Uploader yourself from the GitHub repo
git clone https://github.com/FineUploader/fine-uploader.git
cd fine-uploader
npm install
make build
The "contribute code" section in the README contains even more details.

Why does Grunt not add itself to the shell?

I have a problem installing grunt. All the documentation, and blog post tutorials, say that running:
npm install -g grunt
will then allow you to run grunt commands from the terminal.
I have a situation where grunt appears to install with no errors, but typing the command grunt in the terminal still gives:
-bash: grunt: command not found
What could I be doing wrong? And where could I find grunt to add it to my BASH profile manually?
Since Grunt version 0.4 (which was released 1 or 2 weeks ago) you need to install the grunt command line tool globally (if needed, use sudo before the command):
npm install -g grunt-cli
In your project location you then install the latest grunt version:
npm install grunt --save-dev
Option --save-dev will save the npm config in your package.json file, which makes it easier to install or reinstall the dependencies (using just npm install).
Try running the install with the verbose flag:
npm install -g grunt --verbose
You can see where it is being installed (something like /usr/local/share/npm/bin/grunt). Then check your path:
echo $PATH
If the path does not contain the install bin location, modify the path in your bash profile to include the location of the bin directory, then try grunt again in a fresh terminal.
UPDATE: Grunt 0.4 altered installation process. For 0.4 installs, see answer from asgoth below.
It seems that grunt in the current version 0.4.0 does not install a bin command. The last 0.3.x version is 0.3.17, which supports a bin command. To run grunt from the command line, you will want to install the grunt command line grunt-cli:
npm install -g grunt-cli --verbose
I had installed node using Homebrew and this was my solution:
set config for -g (GLOBAL) install directory directory: npm config
set prefix /Users/YOURNAME/.node/
make sure to edit PATH: sudo nano ~/.profile
add to path: export PATH=“/Users/YOURNAME/.node/bin:”$PATH
then update source: source ~/.profile
Following these steps will allow any packages installed using npm install -g somePKG to be placed in the correct location regardless of your current working directory. And by updating your $PATH correctly command line functions will work.
Information based on:
Fixing npm permissions - bit.ly/1CmIyqx

Resources