Fatal error: spawn cmd ENOENT - Grunt Serve - angularjs

When i run grunt serve i get this.
Running "browserSync:livereload" (browserSync) task
[BS] Access URLs:
------------------------------------
Local: http://localhost:9000
External: http://192.168.1.5:9000
------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.5:3001
------------------------------------
[BS] Serving files from: .tmp
[BS] Serving files from: app
[BS] Watching files...
Fatal error: spawn cmd ENOENT
Hello Stackoverflow! I have been trying get the yeoman-angular server running. I have got the server running before but now i keep getting this error.
I believe the major problem here is Spawn cmd ENOENT. I have googled the error but i still have no idea what to do. It seems my Path environment is messed up. Please help!

I had this same error running grunt serve on a 64-bit Windows 7 system. I've never experienced this problem on my Macbook Air. What worked for me was right-clicking and opening the Command Prompt using "Run as Administrator." I was then able to navigate to my project directory and run grunt serve without errors. I noticed that this modified my system path, so I agree that this is probably a path-related issue.

I had the same problem running browserSync on Windows 7 64-bit.
Just in case if anyone stumbles across the same problem, I had to add %SystemRoot%\system32 to PATH environment variable and it solved the issue. %SystemRoot% usually resolves to C:\Windows\system32 (and it contains cmd.exe).
I remembered this solution from one of the issues in GitHub browser-sync repo. I will update the answer with the issue link, if I find it.

Related

Cannot deploy to with gh-pages with specific project due to error: cannot spawn sh: No such file or directory

Keep getting the error:
error: cannot spawn sh: No such file or directory
fatal: unable to fork
The project builds correctly but when trying to deploy my website it fails.
Website was created with "create-react-app" on my windows 8 pc with the command "gh-pages -d build"
This issue only occurs in this specific project on my pc as when I create a new project with "create-react-app" on my pc it'll deploy fine. This specific project can also be deployed fine with "gh-pages -d build" on my mac but not my pc.
Error of failing to deploy on console
Error log console references
Repository
Somewhere along the line I must've messed up something. I've looked over the web, tried reinstalling git, editor, dependencies and am super confused as to what's causing this. It must be an operating system difference? Thanks!
It's trying to spawn sh.exe but can't find it.
You need to add the git directory that contains sh.exe to your system variables.
(go start and type: 'path'. This should provide you with a shortcut to 'system environment variables'. If not look up how to edit environment variables on your version of windows.)
Once you have the environment variables dialogue box open, have a look in the System variables > 'path' list. There may be a git directory there that doesn't contain sh.exe. You need to replace it with one that does (ensure this also contains git.exe).
On my pc sh.exe was found in:
C:\Program Files\Git\bin
Once this is done restart the terminal and attempt to deploy again.

BROWSER SYNC headless environment ERROR

So i just started learning Angular 2 and after running the npm install command on git bash and opening my text editor, I was trying to run the npm start command to start the typescript and lite server. Everything went well until this error showed up [1] [BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false) and the browser didn't open. Here's how it looks
`
$ npm start
[1] [BS] Access URLs:
[1] --------------------------------------
[1] Local: http://localhost:3002
[1] External: http://172.30.31.239:3002
[1] --------------------------------------
[1] UI: http://localhost:3003
[1] UI External: http://172.30.31.239:3003
[1] --------------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] [BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)
`
I'm using a Windows 8 64bit OS and Chrome is the default browser
A related question https://stackoverflow.com/a/42845813/8130472 was answered and suggested the option of adding C:\Windows\System32 to the System Variables but i don't know how to go about it.
Also, on this link, https://forums.bignerdranch.com/t/browser-sync-couldnt-open-browser/10936/4 another suggestion was to add the --browser"chrome.exe"(Windows). That didn't work either.
Any suggestions? Or Solutions?
So while I kept browsing, i found a clue to the solution of this problem on this webpage https://gist.github.com/Kenty/9096000/revisions which hinted me of where i could find the open option from the error message. I decided to searched for "bs.config.js" on my pc and i found a file called default.config.js in my \Template\node_modules\browser-sync\lib folder under my angular folder and when i searched through the file, i finally found the open option and changed the open option from "local" (which is the default option) to false (Note, it's without the quotes) and when i ran the npm start command again, on the git-bash terminal It worked and there were no more errors.
Add browser attribute, for instance to use firefox : firefox: '-browser "firefox.exe"'
browserSync.init({
server: "./src",
firefox: '-browser "firefox.exe"'
}
A related question https://stackoverflow.com/a/42845813/8130472 was answered and suggested the option of adding C:\Windows\System32 to the System Variables but i don't know how to go about it
About adding to system variables, you can go to "This Pc" properties then to left side bar "advanced system settings" then at bottom you will see "environment variables". You will see Path variable listed double click and copy paste above path i.e C:\Windows\System32
After restart this really solved my browsersync problem.
I tried this command and it worked for me:> browser-sync start --server --browser "chrome.exe" --directory --files "*"
you have to change something in Packages.congig file in visual studio
{
"port": 3000,
"server": {
"baseDir": "."
},
"browser": ["chrome"]
}
It worked in my computer, you should try it at once
Just running cmd as admin might solve the problem
I also had the same problem.
Open your favourite browser and in the search bar explicitly write the local access URL just mentioned above the error you got in the command promt like localhost:3002. You might have got port number like 3000 or 3001 there. Press enter and Browsersync would be connected and index.html is executed.
I hope this works for you as well!

Play Application Couldn't be Started

Recently I've been assigned for a project created with AngularJs and it uses Java Play framework to run it. I use IntelliJ-Idea IDE for the development and to run this application.
Once I clicked on "Run", it gives me following errors in the console.
'force' enabled
Will run: [gulp, --gulpfile=gulpfile.js, watch, --force] in /home/supuns/Projects/bd-business-portal/ui
java.io.IOException: Cannot run program "gulp" (in directory "/home/supuns/Projects/bd-business-portal/ui"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
[trace] Stack trace suppressed: run 'last compile:run' for the full output.
[error] (compile:run) java.io.IOException: Cannot run program "gulp" (in directory "/home/supuns/Projects/bd-business-portal/ui"): error=2, No such file or directory
[error] Total time: 2 s, completed Oct 24, 2016 10:54:25 AM
Process finished with exit code 1
I can't figure out what is happening because I'm new to the environment.
UPDATE:
Sorry about the less information I have given in my question. I have globally installed gulp but still it is not working.
Here's the content of build.sbt file.
name := """bd-business-portal"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)
With the help of my team members I have found the reason that cause this issue is IntelliJ-Idea doesn't know the path to 'Gulp'. I'm using Ubuntu 16.04 and even though I have set the path globally it doesn't understand where to find gulp.
Therefore I have installed sbt and from the IntelliJ terminal ran the command:
sbt run
and it worked.
Update
As I had to work on multiple Play framework sbt projects, doing "sbt run" on the terminal and closing IntelliJ windows to free the port was bit hectic. Therefore I decided to find the actual path variable that created this behavior and I found the PATH variable saved in /etc/environment was "/home/supuns/.nvm/versions/node/v6.9.1/bin/gulp" and I changed it to
/home/supuns/.nvm/versions/node/v6.9.1/bin
Then the IntelliJ "Play" button worked as intended.
I also faced the same issue. I fixed it by installing gulp cli along with gulp. Below 2 commands fixed my problem:
npm install -global gulp-cli
npm install gulp --save-dev

Can't 'npm start' my React project [duplicate]

Get this error in windows cmd when I try to build (emulate) Cordova app.
D:\dev\Cordova\toDoList>cordova build android
Running command: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
I checked system variables one more time and found the cause of the problem:
missing C:\Windows\System32\ variable.
I added it and that solved my problem
Hope, it help you too.
just add it to the PATH: C:\Windows\System32 and start cmd as Administrator
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.
I know this is old but I simply had to run Visual Studio 2015 as an administrator and it worked on Windows 7.
I know its too late to answer, but incase if someone ran into trouble again.
I tried the solutions above which tells to add System32 path, But in my case the cordova path was deleted by an accident.
So I added C:\Users\Aquib\AppData\Roaming\npm\node_modules\cordova\bin to environment variable path and it worked !

Capistrano / ubuntu

I'm attempting to set up a staging server in my rails 4 app. When i run 'cap staging deploy', the command aborts with the following error:
The deploy has failed with an error: #<SSHKit::Command::Failed: bundle exit status: 7
bundle stdout: Nothing written
bundle stderr: Nothing written
The 'cap abort' follows:
Could not find font-awesome-sass-4.0.2 in any of the sources
Any ideas for how to find what this means? Font awesome sass 4.0.2 is definitely in my gemfile and installed.
I don't know the root cause of this but I had the same issue with paper_trail, updating to a later version and then redeploying did the trick for me.

Resources