Error Installing cordova – Please try running this command again as root/Administrator.

Recently, while installing cordova npm package using $sudo npm install -g cordova, I came across the following error on my MacOS.

npm ERR! tar.unpack untar error /Users/xxxx/.npm/cordova/6.2.0/package.tgz
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! path /usr/local/lib/node_modules/cordova
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cordova'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/cordova']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/cordova',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/cordova',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/xxxxx/npm-debug.log

In a nutshell, it was asking me to run this command again as root/Administrator. A quick search on internet made me run the following command to fix the permission issue.

sudo chown -R $USER /usr/local

Then install cordova without the sudo command.

npm install -g cordova

Although, I received the following warning, the install went through successfully without any error.

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue


A system restart from a previous installation or update is pending

While building a SharePoint 2013 environment, I came across this error when running SharePoint 2013 installation.

A system restart from a previous installation or update is pending

The pre-requisites wizard had successfully installed the required dependencies and restarted several times. And so did I manually restarted the server but in vain.  Looks like this was due to a registry entry that did not clear the session state from pending restart to clear. So, change the following registry key and re run the installation. Lo and behold, the installation started. But make sure you have restarted the server before you make these changes to ensure any genuine pending request for restart are cleared.

Open the Registry editor (run > regedit)
•Navigate to this path “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager“
•Rename the “PendingFileRenameOperations” value to “OldPendingFileRenameOperations“
•Reboot the server

Now proceed with a clean install.



Microsoft .Net 4.5 error while installing SharePoint 2013

Microsoft .Net 4.5 error while installing SharePoint 2013

Lately, while building a SharePoint 2013 farm, I came across this error on all my web front ends and application servers.

Setup is unable to proceed due to the following error(s):

This product requires Microsoft .Net Framework 4.5.

It was quite a frustrating experience since Microsoft .Net Framework 4.5 was installed and I verified it by running pre requisite installer again. After spending some time on this, I found this support article on Microsoft’s site. According to the site, the problem occurs because This problem occurs because the SharePoint Setup program does not recognize the .NET Framework 4.6 or 4.6.1 as a supported version of the .NET Framework.

To solve this problem, Microsoft .NET Framework 4.6x has to uninstalled from the servers when you run the setup. You can install them after that.

  1. Uninstall the .NET Framework 4.6x using Programs and Features or .NET Framework Cleanup Tool.

  2. Restart the server. This is very important step.
  3. Run the SharePoint 2013 Pre requisites tool again.
  4. Run SharePoint 2013 setup to install SharePoint again.

.NET 4.6 can be installed after SharePoint has been installed.

However, my problem didn’t end here for after every reboot, .NET Framework 4.6.x came up which prompted me with the error again.

So it seems that this Windows update “KB3045563” would get installed and configured every time the server reboots. I tried searching for that patch under Programs and Features but in vain. So I found that KB3102467 is the KB that’s being installed as part of the updates. But then I was unable to uninstall this KB through Programs and Features so I used the PowerShell snippet from here and made few tweaks for Windows Server 2012 R2. Finally, I was able to run SharePoint 2013 installation.

I wouldn’t advise to do this while building a new production environment. Instead, chose to rebuild the server with minimal updates.