npm install failed because of virtual directory - node.js

I'm trying to setup a new project which is a git repo stored on a virtual drive (wuala).
Is it possible that this is not possible? Because when I try npm install I get the following error:
node.js:815
var cwd = process.cwd();
^
Error: ENOENT, no such file or directory
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3

Ok, so the issue was node not finding the current working directory. I didn't know it was only a virtual directory, after downloading the folder locally it works.
Now if only there is way to download the folder locally every time wuala is running & to be deleted afterwards...

Could the problem be that Wuala doesn't accept empty folders? This topic seems to suggest non-standard behavior when it comes to empty folders:
https://support.wuala.com/forums/topic/wuala-does-not-accept-an-empty-folder-on-my-lacie-2big-as-sync-partner/

I came across this issue today and I don't think its related to the file system being virtual or not. The answer is really simple and weird.
I followed these steps to reproduce the issue:
Open a Terminal and cd to a directory (let's say /home/user/dir)
Delete the directory from your file manager (nautilus in my case)
The console still shows :
user#user-PC:~/dir$
although the directory doesn't exist.
Run a node command. I ran sudo npm update -g cordova
You get the above error. So, the solution is as simple as being in a directory which exists and then executing the node command.

Related

clasp is not recognized after installing on windows 10

I am trying to use Visual Studio Code as Google Sheets Script editor on a win 10 machine.
To make a long story short I will not describe all my steps, as I didn't really understood at the beginning exactly what I need. I also wouldn't be able to do it even I want to.
The current situation is that clasp is not recognized on the system.
These are command line results:
c:\>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
c:\>where clasp
C:\Users\XXX\AppData\Roaming\npm\clasp
C:\Users\XXX\AppData\Roaming\npm\clasp.cmd
on drive c: root (and any folder other than C:\Users\XXX\AppData\Roaming\npm\clasp) clasp is not recognized
c:\>clasp -v
'clasp' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\XXX\AppData\Roaming\npm>clasp -v
2.3.0
One suggestion I found is setting Windows user variable as follows:
SET NODE_PATH=% APPDATA%\npm
Didn't help.
npm related paths on Windows PATH :
C:\Users\XXX\AppData\Roaming\npm
I tried to add to PATH the following file path before the one above
C:\Program Files\nodejs\npm
Didn't help
Based on this post looks like npm is actually installed twice. For current user C:\Users\XXX\AppData\Roaming\npm and for all users C:\Program Files\nodejs\npm.
Maybe this is the problem.
I would like to start over from clean env.
How can I uninstall the local user npm installation on C:\Users\XXX\AppData\Roaming\npm?
You need to add path to npm in environment variables. Then it will work.
Press Ctrl+r
Write %AppData% and hit enter
You will land on roaming folder
Go to npm folder inside roaming and check if a file named clasp is there or not
If yes, then add the path to npm in environment variables
In my case the path is C:\Users\HARI\AppData\Roaming\npm

How to remove entire files and folders created for the nodejs and npm installation

I don't know what happend. All of a sudden, my nodeJS and npm started not responding and many errors popup and i reinstalled many times and not yet that works. When one problem solves, another rises. So i want to clean enitre setup files including in registery and other areas. Please someone help me.so i can reinstall node and npm.
To remove node from your window follow below instructions
1- Uninstall node from Programs & Features with the uninstaller.
2- Remove all the shortcuts like on task managers/ desktop etc
3-Reboot your system
4-Remove all the folder given below
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
5-Remove from the environment variable via checking Path value
6-Open your command prompt try to run below command
where node
If it will show directories then delete all the directories
7-Reboot your system
8-Go to the node js side download or directly install the node from there.

.install Command not found while installing PopcornTime

I am trying to install Popcorntime in ubuntu 14.04 from .tar. I have extracted .tar successfully. Then according to this link I have written sudo .install while I was in my extracted folder. But I get "sudo: .install: command not found". Also there is no .install file in my extracted folder. What can I do?
I have written sudo .install while I was in my extracted folder. But I
get "sudo: .install: command not found"
The command given there isn't sudo .install; it is sudo ./install. You have missed a / in between . and install.
And, . represents current(present) directory in which you are(here /opt/popcorntime), as displayed on the terminal.
So, install is a file inside the current directory (install is a file inside the /opt/popcorntime/ directory) , which would be /opt/popcorntime here; since you have done cd /opt/popcorntime in the previous step.
I hope it resolves your query.
If the executable "install" file is not found in the extracted package then it is probably a pre-installed package. In this case there should be an executable file called Popcorn-Time, and all you have to do is type the following command ./Popcorn-Time and the application will be launched.

Install Node.js on a different hard drive from C to D

I have node and npm with existing packages currently installed to the C drive on Windows. My C drive is an SSD with a low amount of space. How can I move the node installation to a different drive? Would I need to reinstall node and all packages? The current node installer doesn't seem to specify drives.
You can move the node.exe to the d drive. Then check your environment path. Type set in a command window or in computer properties. Make sure you have the folder that contains node.exe in your path. Running node in a command window will work from any folder then.
For installed npm packages, ie.. node_modules folder.. That just needs to be in a directory above where your writing your code, so try putting that folder in d:\ Assuming your going to be writing your apps on the d drive now.
In .npmrc file, change prefix setting to desired folder. Global packages get installed in node_modules under that folder
I'm not sure what you are talking about, the node installer has this page.
What version of node are you trying to install? This screenshot is taken from v0.11.7 of node.
I know this post was basically forever ago, but I found a much easier way than manipulating the path. Simply uninstall NPM using the npm uninstaller, reinstall on your other drive with a new folder called nodejs. It'll create the folder in there appropriately and npm will be successfully installed on you D drive.
Search -> Environmental variables of system
click on path ( both )
click on new
add the path of your node.exe file
boom you are done*
node -v to check

grunt-init not creating any file(s)

I probably missed something here. I'm using Node 0.10.1 on Win7/64bit and installed grunt 0.4.1 with
npm install grunt
npm install -g grunt-cli
npm install -g grunt-init
Then I tried to install a template while in folder %USERPROFILE%
git clone git#github.com:gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile
But git wants a passphrase for key [current folder]. So I just created a folder
%USERPROFILE%\.grunt-init\gruntfile\
and copied
https://raw.github.com/gruntjs/grunt-init-gruntfile/master/template.js
to it. Now I switched to the project folder and was able to start grunt-init with
grunt-init gruntfile
DOM involved? n
files concatenated or minified? Y
package.json? n
any changes? N
Process ends with "Done, without errors", but no file ist created, or at least I can't find it.
dont know how to clone into your userhome on windows, but IMPORTANT(!) you also need to copy the whole "root" directory ( https://raw.github.com/gruntjs/grunt-init-gruntfile/master/root) to '%USERPROFILE%.grunt-init\gruntfile\'
you know that this init-template will just create a gruntfile.js for you? (inside the root-directory you can see that). if you want to create a node-module, jquery-plugin and so on, use one of the other templates (grunt-init-node, grunt-init-jquery) and so on.
creating your own template is easy. just create a new folder in '%USERPROFILE%.grunt-init' with your template-name. add the template.js. add a root-directory where all the files are which you want to be copied, maybe add a rename.json (for folder and file-renamings) and maybe change some stuff in the template.js.
I think you are have few a different issues here - from your comments it looks like you are using a Windows.
The first issue is that you can't clone the repository. Having tried this myself, I found the problem was fixed by setting up a valid ssh key on my github account. So to clone this repository you need to create a github account and install ssh keys on both your machine and your github account. Github's documentation on how to do this is very good and can be found here for Windows https://help.github.com/articles/set-up-git#platform-windows.
The second issue is that the git clone command you are using won't work on a Windows machine as it supplies a path to a Linux home directory ~/.grunt-init/gruntfile.
From your comments I am guessing the %USERPROFILE%.grunt-init\gruntfile\ is the correct install directory for Windows and so changing your working directory to that and using the command git clone git#github.com:gruntjs/grunt-init-gruntfile.git should install it.
You may also consider working using Cygwin which allows you to use a linux working environment on a windows machine.
Happy node hacking.

Resources