I am running grunt serve and when it exits and I try to run it again the port is taken and it won`t run. How do I exit so that the port is not taken?
I am trying out yeoman and I am not familiar to the tools it uses.
I'm using Ctrl+C to stop the grunt livereload server, that has newer given me that problem that it would not release the port.
Related
Is there a way to start node.js's lite-server from grunt?
I have grunt in watch mode and to use both at the same time I need to open two command prompt (windows). I'd prefer to start both with one grunt command - if possible.
The plugin grunt-exec does the trick with the command npm run lite (depending on package.json configuration).
I'm getting slightly confused with grunt and magento 2. Should I be using Grunt on the server or on my local machine? New to grunt so any pointers would be greatly appreciated.
Local machine. You don't need to run it in production, because you should be running setup:static-content:deploy with the Magento CLI when deploying to production, which will compile all static content for you.
For development, Magento 2 provides a Gruntfile.js.sample and a package.json.sample for local development. You should rename them to Gruntfile.js and package.json, and then install the dependencies with npm install. As long as you have grunt installed, you should be able to then run the grunt commands to compile your code while you are developing. You can see more info and the grunt commands here: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html
You should also make sure that you are running your local development environment in "developer mode": http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-mode.html#change-to-developer-mode
Grunt should be used locally and staging, whenever you have the application in developer mode. In production mode (live site) it shouldn't be used.
I am following the installation guidelines as described on mean.js.org Everything seemed to install fine. I have all prereqs installed. I ran npm install after cloning the github repo and then tried to run grunt and I didnt get any errors however It seems to just be stalling on the command line. Last message on the command line is the "debugger is running on port 5858" and then it just sits there.
After some time the message [nodemon] watching 51,839 files - this might cause high cpu usage. To reduce use "--watch" comes up. I am on windows 10 and have all the latest versions of node,npm,grunt and mean.js. I am running the command line as admin.
Mean.js should be running on localhost:3000 but it is not.
This is intended.
There is an application invoked by the grunt command and running in background, watching your files for changes. In default configuration: nodemon and grunt-watch.
This will execute specific tasks based on the files you edited, such as linting JS files or compiling LESS files.
The cmd will probably show something when you edit files in the projects directory.
I am trying to get my localhost working on my remote (mediatemple) server.
I have bundled it up and have a /myurl.com/bundle folder with the following files.
this folder contains
main.js
npm-debug.log
programs
server
How do I get this to run?
You should take a look in the README inside the bundle folder. Normally everything ist described there to start your app.
Make sure that NODEJS and MONGO is installed on your remote server. This is NOT included in your bundle as well as NODEJS is not present.
If you are running a system like debian or ubuntu normally you can do the installation with
apt-get install nodejs mongo
Make sure, that the nodejs has release v0.10.36 or v0.10.38
node --version
At the README you see the necessary ENV-VARS like MONGO_URL and PORT you need to set to start your meteor app.
If you have running a apache server already the PORT 80 is already blocked, so try PORT=3000 to start your meteor app.
Example:
MONGO_URL='mongodb://localhost:27017/yourapp' ROOT_URL="http://yourhost" PORT=3000 node main.js
If using as above you do not need to export the ENV-VARS before start
Sometime when starting, there are missing NPM – you get fiber errors
In that case
cd programs/server
npm install
and the try start again.
Good luck
Tom
(I'm writing this response assuming that you are not worried about scalability issue, respond in comment if you want to scale your app)
The best option for running a node application, which Meteor application is, is by using forever.
npm install forever
forever start simple-server.js
If you want to figure out how to see the log files and how to stop/restart your service, you can run forever --help to see all the commands.
I am running karma with grunt and I am using the advice from the karma-runner page how to configure it to watch on changed files:
Config your watch task to run the karma task with the :run flag. For example:
...
In your terminal window run $ grunt karma:unit:start watch,
tests are run and everything is fine except for the fact that karma starts reporting in the console in teamcity format (and I have it nowhere in the settings or dependencies) and insists on using PhantomJs regardless what settings I put in the browser array.
What could be causing that behavior?
It turned out the problem is missing explicit port value in the karma conf