Cloud 9 and Grunt.js - javascript

I'm running grunt.js on Cloud9. Most everything is working correctly, except when I try to set this option:
'watch: {
options: {livereload:true},'
If I add that, the terminal states: 'Fatal error: listen EACCES'
I'm guessing I need to use the sudo command to run that and since c9 doesn't let you run sudo, the command fails.
But why is livereload a feature that requires permission? And is there any way around it?

Related

Git return "'pull' is not a git command. See 'git --help'" from remote on Windows 10

I have a bonobo server on my server that is running windows 10.
I'm trying to link a new hook on "Update", so the files from the node development server can get updated directly from git.
I tried to do so using a cmd file, examples to follow:
update file in hooks
cmd //C "start C:\webServer\node\testServer\update.bat"
update.bat on the same folder on testServer
set PATH=%PATH%;C:\Program Files\Git\cmd\git.exe
cd C://webServer/node/testServer
git pull
That was returning the following error:
git: 'pull' is not a git command. See 'git --help'
I did some research and found out this post "git pull" broken where they talk about using -exec-path on Mac, I tried to search the equivalent in Windows and found out some variables for path related issues, tried them an none of them worked, also tried to reinstall git without any other result, at that point I was tired of it and I tried to use a node library, simple-git, that allows me to do a pull request using node specifying the path! I tried it on the server, and it worked! (I will attach the code of the file below) so I thought to try it from the remote server, but then I got the same error again, pull is not a git command, I tried to call the node file in different ways, I tried some python script to run a cmd command that runs the node server, I tried using bat and sh files, even using node to run another instance of node, and nothing worked, it always returns pull is not a git command :/
Node simple-git code
require('simple-git')("C:\\webServer\\node\\testServer")
.pull(function(a,b){
console.log(a,b); //for debug
})
Has additional information, git is properly set up as an environmental variable and I can access it without problems from the server, this issue only happens when trying to execute the pull from the hooks!
If anyone can give me some tips on what to try that would be awesome, thanks!

Bot shuts down when putty window is closed

I created a discord bot and am now attempting to run it off an Ubuntu Machine.
I installed the folders of the bot and NodeJs, here is what I used to install NodeJS:
sudo apt-get install -y nodejs
Then I used cd to select the directory, and started my bot using node index.js
The bot started, however when I went to close the putty and keep it running on the VPS the bot shutdown. Here is what the directory looks like.
I think the problem is that when you start the app in the putty window, that process is linked to the window and gets terminated when that is closed.
To avoid that you can use a host service like screen, tmux, nohup, bg and so on...
If you want to know which is the best, try looking at this question from the askUbuntu Stack Exchange.
The key concept is that you open a new window using the tmux command (or screen, ...), then run your bot like you always do. When you want to leave but keep the process runing, you can detach the session with a key combination, that changes from service to service.
If you want to access that window again, you can run a command that will "restore" your session, like
tmux list-sessions
tmux attach-session -t 0
The NodeJS instance is terminated when putty is closed. You need something to keep the instance alive. Try:
PM2: http://pm2.keymetrics.io/
or,
Forever: https://github.com/foreverjs/forever#readme
Recommended though is to run the node instance as a service that can reboot on startup. Try looking at this:
https://stackoverflow.com/a/29042953/7739392
The shell runs in the foreground. This means any scripts you start there will end once you end your session. A simple solution would be to run your script in the background by adding the & after the call:
node index.js &
A better solution would be to create a service you can ask the service daemon to run for you. However, adding the & should get you what you want for now.
I recommend using one of these two node modules - ForeverJS or PM2. I'll show you how to quickly get started with ForeverJS but PM2 would be very similar.
You can easily install ForeverJS by typing the following in your terminal:
$ npm install forever -g
You may need to use SUDO depending on your user's privileges to get this working properly. It is NOT recommended to use it in production due to the security risks.
Once installed CD to your projects file directory and like you typed 'node index.js' you will do something similar with ForeverJS.
$ forever start index.js
Now when you exit the terminal your NodeJS application will remain as a running process.

Big error when trying to set up Github pages

Trying to set up project on github pages, but during following steps from
here
at step 2 I getting this error from images
Any idea?
I working on Win7
with NPM 5.6.0
Node 8.11.3
It seems you need to run as administrator, like so: sudo npm install --save gh-pages.
Or if you'd running on Windows could be:
right-click on CLI icon
open as administrator
Perform your command (now you're administrator)
The error you're getting indicates you need to elevate your shell's permission.
Use your environment's equivalent of sudo/"Run as Administrator" to grant the proper access to perform the functions required to install.

EPERM: operation not permitted, lstat when running ng build

I'm getting an ERROR when trying to run ng build on my angular 4 app.
EPERM: operation not permitted, lstat '<dist directory>'
Has anyone encountered this issue?
TIA
I had the same problem.
As #Mauricio De La Quintana said, the problem is permission.
In my case (Windows environment), I solved the problem by removing the read-only property from the Repos folder and adding write permission to the Everyone user.
This probably a permission issue, just restart your IDE with admin permissions!
In my case I had to restart VsCode as administrator.
While running npm run build - I received error
Open Task Manager -> Select Chrome - > End Task
-> Select VSCode -> End Task
Opened the Project again -> Run npm run Build ---> worked for me
This has happened in my ASP.NET projects. For me this has happened for one of two reasons.
This can be a permission problem so you need to run Command Prompt as Admin.
a. Press win to open the start menu. Type in cmd to search for Command Prompt.
b. Press ctrl + shift + enter to launch Command Prompt as administrator.
This can happen when you build your web project in Visual Studio(or another IDE) and it is currently running.
a. This is a simple fix click the stop debugging and then try 'ng build' again.
Just restarted the VSCode and ran in admin. That solves my problem.
I saw this problem when running IISNODE...
Solution: Ensure that AppPool Identify from IIS has read permissions all the way from root of harddrive to website files.
Full answer is here https://github.com/tjanczuk/iisnode/issues/247
I had this issue while running a build on windows at the same time WSL was running in the directory. The issue was resolved by closing the WSL terminal.
Simply follow these steps
Restart VS Code
run npm run build
I think it is a permission problem, when you do ng build you also delete the previous files. I suggest using
sudo chown -R youruser /pathAngularApp
I had the same problem, and it was related to what #goku_da_master commented, I had the vueJs application running even when my VsCode stopped, I figured it out from the task manager and fixed it like this:
I opened the task manager
I searched if Node.js was running
Right click on the Node.js process
Finish Task
"npm run dev" again
I experienced the same problem. The fix for me was to install the correct node version that the project was requiring (an older one), then closing all terminal windows in VS Code, and relaunching VSC.
To switch node versions, I installed nvm and had to make sure the default alias was pointing towards the exact node version I wanted.
Error : Error: EPERM: operation not permitted, lstat 'C:\Users\Administrator'
We encountered this error after the Windows update.
This Solution worked for me;
Go to C:\Users\Administrator
Rename the file NTUSER.DAT as NTUSER-old.DAT

Gulp-plumber not found in Ubuntu OS, but found in Windows OS on dual boot

I am following a tutorial, and I am supposed to have a gulpfile.js running, but I'm encountering a strange situation. Gulp works in one location and does not work in the other.
I have a dual boot for Ubuntu and Windows 8.1. In the Ubuntu OS Documents directory the gulp command does not work, but returns an error saying "'gulp-plumber' not found". I don't understand why since the folder structure is exactly the same. If I change directory to the windows volume and access the main project folder, when I type "gulp" everything works fine.
Additionally, if I CTRL-C in the command line, the gulp command stops working and returns an error saying:
events.js:163
throw er; // Unhandled 'error' event
Error: write EPIPE
So how can I run the gulp command again? Is it through ps aux, check something running and then kill it?
github.com/DannyS95/Project
This issue has been fixed, i had to install gulp plumber, because i did not have that package in the package.json file.
Then a quick npm install, and since i have gulp globally i can just run gulp and voila, it works.

Categories