Running a command inside a folder which has a path with spaces - cmd

I want to run a gulp command inside a folder C:\Projects\Workspace - ProjectX\webapps\ so what I'm doing is I cd into this this folder from command prompt and I run this command :
gulp prepare-source -m prod
but I get this error :
'C:\Projects\Workspace' is not recognized as an internal or external command, operable program or batch file.
How can I solve this ?

This seems to be a known issue in gulp-protractor. Please check the following links for status update on the issue:
https://github.com/mllrsohn/gulp-protractor/issues/64
It seems it has been fixed for Windows 7. Check if you are running the latest version of gulp.
https://github.com/mllrsohn/gulp-protractor/pull/112

You need to install gulp globally if you want to run it anywhere.
npm install gulp -g

Related

installing npm in Laravel in order to use Bootstrap in my project

i'm new to laravel and it's been a while that i'm trying to install bootstrap files(css and js) .
i first did this in cmd :
composer require laravel/ui --dev
which ended in
Package manifest generated successfully.
then :
php artisan ui bootstrap
that showed me :
Bootstrap scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
but now when i execute npm install in cmd , it shows me an error :
'npm' is not recognized as an internal or external command,
operable program or batch file.
what the hell is wrong with it ??
It means you either don't have npm installed on your device or you don't have your path mapped to where the command is held. How you solve that problem depends on what operating system you are on.
https://www.npmjs.com/get-npm
If it's installed but not recognized as a command, then you need to add it to your path:
Open start in the taskbar and search "environment" and click edit the system environment variables.
Click the environment variables button. There should be a "Path" variable for either the user or system. If the user has one, click to edit it.
Click new and give it the path to the directory that contains the node command (e.g. C:\Program Files\nodejs\).
Press OK and then restart your terminal/powershell and try again.

How to customize the admin page of strapi?

I am using strapi in one of my projects and it is good to use but the problem is I am not able to customize the admin page. My operating system is windows 10. Whenever I make any changes in the source code and run npm run setup or npm run build on the command line to make those changes reflect in the build file, it gives the following error : 'APP_PATH' is not recognized as an internal or external command, operable program or batch file.
Has anyone came across similar issue and was able to resolve it?
I have this error too
npm run setup error 'APP_PATH' is not recognized as an internal or external command
i use windows 10 x64 and npm version 6.4.1 and MongoDB shell version v4.0.10.
I have Error on admin/scripts/setup.js.
my problem Solved by added set key to commands(two line)
" && APP_PATH="${appPath}" npm run build`
to
" && set APP_PATH="${appPath}" npm run build`

'gulp' is not recognized

I'm completely new to Gulp but I wanted to try it out. Due to restrictions/admin rights on my desktop and moving about a lot, I need things portable, and so am currently running everything I need off a stick.
I've browsed similar posts but none of the solutions seemed to solve the problem I'm having.
I used the following commands in cmd with Ruby to install gulp -
npm install -g gulp
and then
npm install --save-dev gulp
I'm seeing the folders and files, but when I run gulp -v in cmd I get the following:
" 'gulp' is not recognized as an internal or external command, operable program or batch file."
I'm not sure if this is a problem related to the fact I don't have admin rights for this computer or not. Any help so I can troubleshoot further would be much appreciated!
E:\xampp\htdocs\wordpress>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\RailsInstaller\Git\cmd;C:\R
ailsInstaller\Ruby1.9.3\bin
Thanks
My Full Response
Solution
Re-download nodejs
npm install -g gulp
gulp -version
I had the same problem when I installed gulp, I was not able to run gulp in command line. I was getting the following error:
'gulp' is not recognized as an internal or external command,
operable program or batch file.
After doing some re-search I found that I needed to update the Path variable.
Following is the command you can run in command line to add the path to the system path variable.
C:\> PATH=%PATH%;C:\Users\**<username>**\AppData\Roaming\npm
Using VS2017, Net CORE 1.1 I received this error.
I ran the following in a command window at the root of my project:
cmd.exe /c gulp --tasks-simple
This showed me the real error in a stack trace: there was a typo in my gulpfile.js.
So for me the problem was a simple typo and had nothing to do with gulp, npm or installation.
Seems that you didn't configured the /bin folder of your node installation in the PATH variable, however in windows it should be done automatically. The PATH in your question refers to C:\Program Files\nodejs. You can add the environment variable manually or download the latest version and try again.
For those using linux, (if downloaded the Linux Binaries (.tar.xz)) please add, in your home (~/.bashrc), the export of node's bin folder, like:
export PATH=$PATH:/opt/node/bin
1- Check Is NPM Global installer installed the gulp or other package what you looking for
the default path is "C:\Users\YOUR_USER\AppData\Roaming\npm"
If the gulp executable on there you have installed it globally. If not install it globally. Like above right:
npm install -g gulp
2- Add it to windows environment system variables like that to working with it on your local IDE
NODE_PATH %AppData%\Roaming\npm\node_modules
GULP_PATH %AppData%\AppData\Roaming\npm
NPM_PATH %AppData%\AppData\Roaming\npm <- one of them
If someone is having this issue with an npm script that uses gulp, and with gulp as a dev dependency in your package.json, you shouldn't need to install gulp globally, I fixed it by doing a clean install.
npm ci
It sounds like theres some information missing, and while Im a bit confused about the 'commands in cmd with Ruby' this might set you down the right path.
After you install Gulp globally, as you did; npm install -g gulp, you want to cd into your project root and npm install gulp --save-dev. This is all outlined in this article, which is recommended alongside some other getting started articles by Gulp.

'ionic' is not recognized as an internal or external command

I have successfully installed Ionic. In fact, I have ran it many times already and it worked perfectly fine (on my browser using "ionic serve" command).. But when I have not done "Ionic stuffs" for a few days, and tried doing it this morning, the command is now unrecognized. What is wrong with this?
Running Windows 7 and ran into this issue myself. I ensured that I was running my command line as Administrator, cleaned the cache as suggested but continued to get the error that 'ionic' is not recognized...
After trying several other suggestions, I finally browsed to my nodejs location: C:\Program Files\nodejs
I ran the nodevars.bat to open the nodejs command prompt, ran the ionic command and everything worked as expected. I'm not sure what the issue is but running command from that .bat file appears to fix it.
I added this the path and all worked well.
%APPDATA%\npm;
I already solved it. :) For some unknown reason my ionic installation went MIA. And I didn't solve that directly, it had errors that says "Run as Administrator", etc when in fact I'm running Admin... The trick was to clean the cache before reinstalling Ionic using the npm cache clean command.
It had errors that says:
Run as Administrator
etc, when in fact I'm running as Admin... The trick was to clean the cache before reinstalling Ionic using the command:
npm cache clean
It worked for me. Just run npm command for cache clean and reinstall the ionic as:
npm install -g ionic
and it works perfectly fine.
After a couples days of this exact issue, I found my solution. Remove all of corodva with npm uninstall cordova and ionic with npm uninstall ionic. Then clear the cache with npm cache clear. View this for full removal https://stackoverflow.com/a/29429357/5144902
I then found that there was a couple folders still in my C:\Users\USERNAME\AppData\Roaming\npm. I could not remove this, as the file extension was too long. I opened cmd, and removed it with the DEL command. I then found that a node_modules folder was under my user folder. I removed that.
Then Global install with npm install -g ionic cordova. Works perfectly.
None of the solutions worked as permanent fix for me and it was pretty disgusting to use a fix every time I intended to use ionic. So, while browsing for a solution, I read some solutions that eventually led to this:
Go to your system settings->Advanced system settings->environment path. In my case, while the 'npm' was indeed added to the system path, it was separated by a single comma inspite of a colon (;). So, I replaced it with a colon and bingo! Please do restart your CMs before trying to test it. Hope it helps!
If you are on Windows, use Git Bash shell and have issues calling cordova and ionic,
maybe you'll have to add a path value to
c:\users[your username].bash_profile
this helped comparing windows path (cmd - echo %path%) with git bash shell path:
Git Bash doesn't see my PATH
for me, global paths were there, but user paths not. I had to add:
PATH=$PATH:/c/Program Files (x86)/Microsoft VS Code/bin:/C/Users/[my username]/AppData/Roaming/npm
answer here
İf "ionic" is installed;
1-Download and upgrade nodejs to latest version.
download nodejs
2- run command:
npm uninstall -g ionic
3-Clear these files:
C:\Users\user\AppData\Roaming\npm
C:\Users\user\AppData\Roaming\npm-cache
3-run command:
npm install -g #ionic/cli
İt is done:)
Go to nodejs installed directory ( in my case it's C:\Program Files\nodejs), then run the bat script "nodevars.bat" with administator permission. That solves my problem.
In the Windows environment, when we install packages with -g option they are not available sometimes while running the package through the command prompt. Steps below that worked for me —
Create a .npmrc file at C:\Users{username}\
Write below line in the .npmrc file. Write path as per the location of nodejs installed in your machine. Add double back slash wherever you have a back slash in the path.
prefix="D:\\programs\\nodejs"
Run the command to install the package again
npm install -g ionic
Run the new command
ionic serve
Variable Name: Path
Variable value: C:\Program Files\nodejs\bin
Try adding this to your user and environment variables , and then close the command prompt window and open.
The bin folder needs to be given for both user and environment variables
I got my problem resolved :)
You can uninstall as
npm uninstall -g ionic cordova
then clear cache
npm cache clean -f
then re-install as
npm install -g ionic cordova
Just go to your C:/users/(your name)/node_mudules, and uninstall node_mudules folder. Once uninstalled, open up node js command prompt and type
npm install -g ionic cordova
this worked for me

How to install and run lessc on top of node.js and Windows?

Hi I am learning LESS and I would like to install lessc on my Windows 7.
Following this tutorial http://verekia.com/less-css/dont-read-less-css-tutorial-highly-addictive
The first step is I dowloaded and installed node.js (node-v0.10.5-x64.msi).
Then in a console, I ran
npm install less -g
I got the following:
npm http GET https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/ycssmin
npm http 304 https://registry.npmjs.org/ycssmin
C:\Users\Me\AppData\Roaming\npm\lessc -> C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc
less#1.3.3 C:\Users\Me\AppData\Roaming\npm\node_modules\less
+-- ycssmin#1.0.1
Then I ran the following in the same console:
lessc style.less > style.css
But I got
'lessc' is not recognized as an internal or external command, operable program or batch file.
I am not sure where I got wrong. I googled but it seems there is too much stuff, not sure which one is right. Did many tests without any success.
Could someone tell me how to do it or give me a pointer to some place with detailed and latest install info for Windows?
In a console, run the following:
node C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc style.less > style.css
style.less must be in the console's directory.
step 1: npm install less -g
step 2: npm i less --save-dev
to get lessc working you have to add
C:\Users\Me\AppData\Roaming\npm
to the path
I guess you could add the bin folder in system properties -> advanced ->environment variables and append the whole path to the bin folder by edited the Path variable.
If you just installed node.js, the windows PATH variable won't be updated within any running CMD windows. Try closing CMD and reopening it!
I fixed this issue by using Node Version Manager (nvm) to install and use the latest version of Node.js
nvm install latest
nvm use 12.4.0
After that I navigated to my project folder and typed:
npm install less -g and then
npm i less --save-dev
Finally I typed lessc less/index.less css/index.css to compile my less.
If you are using windows, don't forget to open the command line console as an administrator.
After spending around number of hours hunting around to compile less files, I got very simple answer:
download node-v0.10.26-x64.msi for windows users -> install it -> then
go to any folder(in command prompt) where *.less files are located and run the command
"lessc styles.lsss > styles.css". (Example: in command prompt, less is my less folder where *.less files exist)
D:\less>lessc styles.less > styles.css
now you will get styles.css files created automatically. Open and see styles.css file
Well, you must have NodeJS installed on your machine, use this link to download and install it.
Once installed make sure to restart your machine.
Then check whether it is properly installed by running "node -v" and "npm -v" in CMD.
Once that is done run "npm install less -g" and you are ready to compile your less files.
Just go into the directory where your files are and run "lessc style.less style.css"
More can be found on this link.

Resources