"npm install -g yo" on Windows 7 - windows

on the following setup
Windows 7 Enterprise edition.
MyNodeJsCommandPrompt>node --version
v4.1.1
MyNodeJsCommandPrompt>npm --version
3.5.0
When I run the following
npm install -g yo
I get errors of this type
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\MyCodeDirectory\npm\node_m
odules\yo\node_modules\update-notifier\node_modules\latest-version\node_modules\
package-json\node_modules\got\node_modules\read-all-stream\node_modules\pinkie-p
romise\node_modules\pinkie' -> 'C:\MyCodeDirectory\npm\node_modules\yo\node_modules\glob
by\node_modules\pinkie'
Can anyone help? Thanks.

Try to use :
npm cache clean
One time, it solved my problem.

This is what solved my problem.
I ran this once. Thanks to #Akram_Saouri
npm cache clean
However, that did not solve the problem by itself. After that I reran the command multiple times.
npm install -g yo
Every time I reran the command it kept throwing the same problem, but I noticed that it kept throwing the same problem for different files. And every time I ran it, it kept making some more progress but would stop on a different file, further down the installation process.
After multiple tries, it ran till the end with a bunch of WARNINGS but there was no ERROR at the end.
So, it was solved, with the steps mentioned below. But, truth be told, I am not sure exactly what solved the problem.
Thanks.

Related

'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

Node.js/Windows error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm'

I have Windows 7 32-bit. I installed the latest Node.js 32 bit.
When I try to run the command npm install jquery, I receive the error:
Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm
How does one resolve it?
Manually creating a folder named 'npm' in the displayed path fixed the problem.
More information can be found on Troubleshooting page
I ran into the same problem while installing a package via npm.
After creating the npm folder manually in C:\Users\UserName\AppData\Roaming\ that particular error was gone, but it gave similar multiple errors as it tried to create additional directories in the npm folder and failed. The issue was resolved after running the command prompt as an administrator.
This can also be fixed by installing a node package manually.
npm install npm -g
The process of doing that will setup all the required directories.
I recommend setting an alternative location for your npm modules.
npm config set prefix C:\Dev\npm-repository\npm --global
npm config set cache C:\Dev\npm-repository\npm-cache --global
Of course you can set the location to wherever best suits.
This has worked well for me and gets around any permissions issues that you may encounter.
You can go to the Start Menu and search the Node.js icon and open the shell and then install anything with
install <packagename> -g
Install a stable version instead of the latest one, I have downgrade my version to node-v0.10.29-x86.msi from 'node-v0.10.33-x86.msi' and it is working well for me!
http://blog.nodejs.org/2014/06/16/node-v0-10-29-stable/
I needed a package from github that was written in typscript. I did a git pull of the most recent version from the master branch into the root of my main project. I then went into the directory and did an npm install so that the gulp commands would work that generates ES5 modules. Anyway, to make the long story short, my build process was trying to build files from this new folder so I had to move it out of my root. This was causing these same errors.

Phonegap installation error (npm)

I have been searching for a solution for two days now to setup Phonegap on my Windows 8.1
system without any success.
Whenever I try to install Phonegap through npm I get an error that I think has to do
with Cordova(-lib).
To install Phonegap I had to install Node.js (v0.10.28) on my system. After this I opened up Windows Powershell and issued the following command like instructed on the Phonegap website:
npm install -g phonegap
Output: (This is the only part of the error)
error notarget No compatible version found: cordova-lib#'lorinbeer/cordova-lib.git#configparser_module'
error notarget Valid install targets:
error notarget ["0.21.2","0.21.3"]
error notarget
error notarget This is most likely not a problem with npm itself.
error notarget In most cases you or one of your dependencies are requesting
error notarget a package version that doesn't exist.
I also tried installing just Cordova through the npm and then install Phonegap, but that
didn't solve anything either.
Running the Powershell with administrator rights also didn't help and tried solutions of other people who also had problems setting up Phonegap, but nothing works.
I really hope that someone could help me out here.
Thanks in advance.
Download the older version. I think there was a problem in the new one
npm install -g phonegap#3.4
I tried this and worked for me.
I had the same issue yesterday. If you check npm-debug.log, you'll notice that there is a permission issue ("Permission denied") when npm tries to access the cordova-lib git repository url. Actually, cordova-lib is a dependency for phonegap. So, it can't install it and I think that's why you get that error.
So, I tried this: install cordova-lib first then Phonegap. Yet, it still won't work; npm does not seem to check if cordova-lib is installed before trying to do it.
At this point, what I could do is to change the repository from which it retrieves cordova-lib. Here is the NPM install syntax:
npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install <pkg>
npm install <pkg>#<tag>
npm install <pkg>#<version>
npm install <pkg>#<version range>
This means I can install from a tar.gz file. Great! So, I just went to this page https://www.npmjs.org/package/phonegap to check the phonegap repository and performed these steps:
Download the zip of phonegap-cli repo (https://github.com/phonegap/phonegap-cli/archive/master.zip)
Unzip it
Open the package.json file and find the cordova-lib entry in dependencies (line 32)
Change the value to 0.21.3 which is the last version.
Recreate an archive of the folder to the tar.gz format
Open your CLI and run this command:
npm install -g path/to/archive/phonegap-cli-master.tar.gz
It should work now.
Hope that help!
I had a similar problem today too on Mac, even after Lorenzo said it should be all fine. Just running this:
sudo npm install -g phonegap
... produced loads of errors like this:
error: file ./objects/pack/pack-48c0ff4147fb7e8922546c4a857b98a1cb48e01f.pack is far too short to be a packfile
I combined Lorenzo and arpan shah's solutions:
sudo npm install -g phonegap#3.4
sudo npm cache clean
sudo npm update -g phone gap
... and it seemed to magically work.
Problem
We published with a dependency on a branch of cordova-lib. This fork appears unavailable when lots of requests are coming through (I think). One way or another, it's unreliable.
Changing the dependency to 0.21.3 will cause commands to fail, but will allow the install.
Solutions
update the 'cordova-lib' dependency to the npm published version '0.21.3'
**note, this will allow the install, but other phonegap commands will fail
wait for about 20 minutes, then npm update -g phonegap
testing an update to resolve this issue
further updates momentarily
update
We've pushed version 3.5.0-0.20.3 which should resolve this issue
$ npm update -g phonegap
if that doesn't work, try
$ npm cache clean
and reinstall phonegap
I tryed above comamnds npm cache clear and reinstall phoegap. It downloaded all libs but not command line scripts (phonegap command had still 3.4 as version). I found that better was to give command: npm install -g cordova (v 3.5)!

Npm Please try using this command again as root/administrator

I've been desperately trying to install modules using node.js but it always fails getting packages with npm.
I logged in as Administrator and used powershell/cmd with "run as administrator". I also had problems with the registry so I used npm set registry http://registry.npmjs.org/
I tried everything... it just drives me nuts.
Here are the errors:
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "generator-knockout"
npm ERR! cwd D:\Sergiu\Knockout Test
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js
npm ERR! fstream_path D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js'
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\fstream\LICENSE'
npm ERR! { [Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\fstream\LICENSE']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'D:\\Sergiu\\Knockout Test\\node_modules\\generator-knockout\\node_modules\\yeoman-generator\\node_modules\\tar\\node_modules\\fstream\\LICENSE',
npm ERR! fstream_type: 'File',
npm ERR! fstream_path: 'D:\\Sergiu\\Knockout Test\\node_modules\\generator-knockout\\node_modules\\yeoman-generator\\node_modules\\tar\\node_modules\\fstream\\LICENSE',
npm ERR! fstream_class: 'FileWriter',
npm ERR! fstream_stack:
npm ERR! [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\fstream\\lib\\writer.js:284:26',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
It turns out that you don’t have to run the command again as Administrator, and doing so won’t fix the problem.
Try:
npm cache clean first.
If that doesn’t fix things, take a look in %APPDATA%\npm-cache, or if you’re using PowerShell, $env:APPDATA\npm-cache.
After cleaning the cache, you may still be left with remnants. Manually remove everything in that directory, and try again. This has always fixed things for me.
As #Crazzymatt was mentioning, as of the npm#5 version and up, we need to use npm cache verify instead of npm cache clean. Or else you will get an error as preceding.
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
(Source: MSDN Blog post)
I solve it running as administrator cmd.
Cleaning the cache
npm cache clean -f
And then try to install the package again
You should run cmd.exe as administrator.
Follow the following steps:
Click Start, click All Programs, and then click Accessories.
Right-click Command prompt, and then click Run as administrator.
Here is how I fixed this on my Windows (7) Dev. environment.
I assume the following...
You are Running Command Prompt, Git Bash, Cmder or your favorite Terminal, as an Administrator by right clicking
Privileges Permissions have been granted for Read/Write (i.e chmod -777)
Okay, let's get to it:
Update any packages where a version check is returning a warning ("npm WARN"..) for example...
npm update -g npm
npm update -g graceful-fs
Next we want to force a cache clean. This is flagged by an '--f' or '-f'..
npm cache clean --f
In Widows Explorer search for the following path
%APPDATA%\npm-cache
And Delete it's contents
Start a fresh instance of your Terminal, remembering to 'Right-Click' and 'Run as Administrator', install the packages again.
Hope this helps someone!!
I was already running the Node Command Window as Administrator. As mentioned by many above, the following command with --f (force) solved my issue.
npm cache clean -f
After the Cache Clean, the install was flawless. See the screenshot for reference
I had to login into npm to resolve this issue.
npm login
If you're using TFS or any other source control for your project that sets your checked in files to readonly mode, then you gotta make sure package.json is checked out before running npm install. I've made this mistake plenty of times.
I had the same problem and I've fixed the error by cleaning the cache:
npm cache clean -f
I had the same problem, what I did to solve it was ran the cmd.exe as administrator even though my account was already set as an administrator.
Try following steps
1. Run this command on Terminal or CMD - npm cache clean
2. Go to this folder on windows %APPDATA%\npm-cache And delete folder which you want to install module (Ex:- laravel-elixir) or if you are using PowerShell, $env:APPDATA\npm-cache
3. Then Run your command EX:- npm install laravel-elixir
Here is how I fixed the problem in Windows. I was trying to install the CLI for Angular.
Turn off firewall and antivirus protections.
Right click the nodejs folder (under Program Files), select Properties (scroll all the way down), click the Security tab, and click all items in the ALLOW column (for All System Packages and any user or group that allows you to add the “allow” checkmark).
Click the Windows icon. Type cmd. Right click the top result and select Run as Administrator. A command window results.
Type npm cache clean. If there is an error, close log files or anything open and rerun.
Type npm install -g #angular/cli (Or whatever npm install command you are using)
Check the installation by typing ng –version (Or whatever you need to verify your install)
Good luck!
Note: If you are still having problems, check the Path in Environmental Variables. (To access: Control Panel → System and Security → System → Advanced system settings → Environment variables.) My path variable included the following:
C:\Users\Michele\AppData\Roaming\npm
npm cache verify
Try for newer versions of npm.
I'm using v 5.5.1 and it's working fine.
This is the flow often happens in this case. You run a command with no admin rights, you get message npm ERR! Please try running this command again as root/Administrator.. Then you open one more CLI(cmd, powershell, bash or whatever) and don't close the previous CLI. It appears you have 2 prompts opened in the same directory. And until you close CLI which runs with no admin rights you will be continuously getting npm ERR! Please try running this command again as root/Administrator. So close CLI which runs with no admins rights before running a new one.
NOTE: a lot of IDE has embedded CLI(Visual Studio, VS Code etc) so please close the instance of IDE as well
For those doing this on a MAC. Simply put sudo in front of the command. It will ask you for your password and then run fine. Cheers
What helped me on Windows 10 was just ticking off "Read Only" of project node_modules.
I messed with this problem 2 times and tried all suggestions here with mediocre success.
First time I tried (and succeeded luckily) by:
delete the node_modules folder in your project
npm clean cache -f
check your %APPDATA%/npm-cache and delete everything if not empty
start the terminal as administrator (in my opinion, it isnt a problem of rights, but it wont hurt if you do so)
npm install and then npm update
you will get errors, just install every module that throws an error manually and step by step try to eliminate everything whats wrong
However, this method is quite frustrating and not working everytime. So try this:
Second time I had no luck with the steps above, so I tried to completely reinstall npm and it failed. So I thought there must something be wrong with my node.js installation. My team is running 6.10. and I had the 6.11. and tried it with the 6.10. with no luck.
So I completely wiped everything off my system. Deleted all node modules, checked every path where node or npm could be and cleaned my system.
Then I installed newest 8.1.3
Deleted my project and cloned it to a complete different directory.
Now I installed and updated everything with npm install npm update
Then I compiled with just 2 modules missing and installed them manually
Tadaaaaa, its working now. So all in all it was a problem with node.js. I recommend to everyone who runs into this problem: Try different node versions! And clean ABSOLUTE everything.
As my last resort with this error I created a fresh windows 10 virtual machine and installed the latest nodejs (v6). But there was a host of other "ERRs!" to work through.
I had to run npm cache clean --force which ironically will give you a message that reads "I sure hope you know what you are doing". That seems to have worked.
It doesn't solve the issue on my main Dev machine. I'm canning nodejs as I found over the last few years that you spend more time on fixing it rather than on actual development. I had fewer issues with node on linux ubuntu 14.04 if that's any help.
Deleting the global npm-cache and/or running my cmd line as admin did not work for me. Also, as of npm version 5.x.x, it supposedly recovers from cache corruption by itself.
This did work:
1. Deleted the node_modules folder in my current project.
2. Deleted the package-lock.json in my current project
3. Installed the new package. In my case: npm install bootstrap#next --save
4. Ran npm install for my current project.
Everything now works. In general, nuking node_modules and package-lock.json usually fix these "no apparent reason" bugs for me.
EDIT
I just had the same problem again. But I noticed that everything was installed correctly even though it threw the error after I had followed the steps outlined above. So I could just run ng serve (for Angular), and everything worked.
This sure is a weird error...
As a hack,
Check if the folder path it is complaining exists or not.
If not, try creating them manually and rerun the installation, after clearing the cache
I had success with this, when running the installation from command prompt as an Administrator didn't work
$ npm cache clean
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
I tried running npm cache verify with admin rights and it worked after that.
This worked for me, if your package.json is not too big you can do this:
Signout then signin.
Delete node_modules.
npm install again.
Like the other answers, clean npm cache and make sure the cache folder is empty, then run npm install several times. Each time the error message comes for different packages, and the final time (after X attempts) it succeeds.
Run npm clean cache --force
cd %APPDATA%\npm-cache (or cd $env:APPDATA\npm-cache for PowerShell)
del * to delete everything in the folder
Go back into the project folder and run npm install several times until it succeeds. Notice that the error messages come for different packages every time.
WHAT WORKED FOR ME
I ran Command Prompt as Administrator. This helped partially - as I no longer got the error, "Please try using this command again as root/administrator". I was trying to install Cordova. To do it successfully, I also had to do the following:
(1) "npm update node", plus...
(2) I also added the " -g " in the >>npm install cordova<<. In other words, type this: >>npm install -g cordova<<
~~~ FOR WINDOWS 8.1 ~~~
"RUN AS ADMINISTRATOR" COMMAND PROMPT
For windows 8.1, I don't have an ACCESSORIES group when I click START > ALL PROGRAMS. But I do have that older -- but trusty and reliable -- START BUTTON and START MENU - thanks to the free Classic Start Menu app. So, with that installed....
ALTERNATIVE #1:
1. Type "cmd" in the SEARCH BOX at the bottom of the START menu.
2. When cmd.exe shows up in the top of the search results, right click it and select RUN AS ADMINISTRATOR.
ALTERNATIVE #2 If you already have a Command Prompt window open and running - and you want to open another one to Run As Administrator:
1. Locate the Command Prompt app icon in the Taskbar (usually along the bottom of you screen unless you have moved it a different dock/location).
2. Right click the app icon.
3. Now, right click "COMMAND PROMPT" and select RUN AS ADMINISTRATOR.
Hope this helps someone.
I don't know which steps worked for me. But these are my steps to get rid of this error:
Updated Node.js
Ran npm cache clean command in Command prompt ( With
some element of doubt for cache presence)
Ran react-native init in
command prompt as Administrator (on Windows OS), hoping works well
with sudo react-native init on Mac OS
Close the IDE
Close the node terminals running ng serve or npm start
Go to your project folder/node_modules and see you if can find the package that you are trying to install
If you find the package you are searching then delete package folder
In case, this is your 1st npm install then skip step 4 and delete everything inside the node_modules. If you don't find node_modules then create one folder in your project.
Open the terminal in admin mode and do npm install.
That should fix the issue hopefully
FINALLY Got this working after 4 hours of installing, uninstalling, updating, blah blah.
The only thing that did it was to use an older version of node v8.9.1 x64
This was a PC windows 10.
Hope this helps someone.
If you're in react native project, and Expo is running, then close it.
Re-install the package, and everything should be fine.
Also remember to end all other npm commands e.g. npm run dev-server.
A solution that worked, is to close all PowerShell and cmd instances. Start PowerShell/cmd again as administrator and things seem to work.
This can happen if you're doing react-native and the node.js cmd is open in the background.
On windows 10,
npm cache clean --force and npm cache verify did not work for me.
Tried to delete cache folder and file with administrator permission, did not work.
The process-explorer tool helped me finding that Node.exe is holding on the cache file. I killed the process and tried to clean, worked.

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