Visual Studio 2015 - Bower not working - asp.net-mvc-5

I'm trying to start a new ASP.Net MVC 5 project using the new Web Development features included in VS 2015. So far I wasn't able to include any bower packages through the IDE. I've made some tweaks regarding npm, git and bower to include the proxy configuration.
The strange thing is that using node console to run bower works well
However when you try the equivalent with the VS external tool
"C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\bower.cmd" install angular
it fails
This is running behind a corporate NTLM authenticated proxy, which is bypassed with CNTLM. But I don't think has much to do as the Node version of bower works perfectly fine. You can see the configuration
.npmrc
registry=http://registry.npmjs.org/
proxy=http://127.0.0.1:8128
http_proxy=http://127.0.0.1:8128
https_proxy=http://127.0.0.1:8128
.gitconfig
[http]
proxy = http://127.0.0.1:8128
sslVerify = false
[https]
proxy = http://127.0.0.1:8128
[url "http://"]
insteadOf = git://
.bowerrc
{
"directory": "library",
"registry": "http://bower.herokuapp.com",
"proxy":"http://127.0.0.1:8128/",
"https-proxy":"http://127.0.0.1:8128/"
}
Any thoughts?
[Edit]
The problem ended up being something about permissions. When running VS 2015 "as administrator" it worked fine. It seems some of the operations when moving files from the temporary download folder to the project folder was being prevented (user profiles are created on a network share in this environment, that's what I believe is causing such a mess).

Visual Studio uses a sandboxed version of node / NPM by default for Bower rather than the globally installed version. This means any config you made for the global versions won't apply to VS. You can change this so that Visual Studio uses your globally installed version instead which I can see has no problems getting through your firewall.
To do this, go to Tools -> Options and look for this configuration page:
Add an entry for node:
Make sure you drag it higher in the list so that it's before the Web Tools\External entry (that's where VS installs it's sandboxed versions of Node and NPM).
Hope that does the trick.

As mentioned in the post itself, it ended up being a permissions issue, when running VS 2015 as administrator the problem disappeared.

Had the same issue, but instead of installing a separate bower, I changed the .bowerrc file in the project root directory to:
{
"directory": "wwwroot/lib",
"proxy":"http://127.0.0.1:3128/",
"https-proxy":"http://127.0.0.1:3128/"
}

Related

NPM missing in visual studio 2017

I have Visual Studio 2017 and added support for Node.JS Development and ASP.Net Core. But when I go to Package Manager Console and write
npm
I am getting following error
The term 'npm' is not recognized as the name of a cmdlet
What could be a problem?
NPM should be fully integrated with VS
https://webtooling.visualstudio.com/package-managers/npm/
The default path for npm is:
C:\%ProgramFiles%\nodejs
You should have a npm.cmd there. The Windows PATH environment variable needs to point to that folder.
My advice is to reinstall nodejs from the source:
https://nodejs.org/en/download/
During Setup, making sure you choose Custom Setup and select "Add to PATH" and make sure it is set to "Will be installed on local hard drive".
(Of course, shut down all Visual Studio instances before doing the above.)

Visual Studio Installer is not installing node.js

In Visual Studio Installer, I selected the Node.js development option. It runs successfully. But, if I try to run cmd node -v. It tells me node does not exist.
I tried a few other things including uninstalling and reinstalling the Node.js development option in VS Installer. Plus installing the latest version of node from the website.
However, when I try to run the pre-packed Angular solution that comes with VS 2017 I have issues. The solution will not even start.
The best I have been able to do is install Node 6.10.3. Once I do that, the web site comes up. But, I get a JavaScript error in the vendor.js file. I am able to continue but I get this error when I try navigate to another menu item. Plus the Hot Module Replacement does not seem to be working. (It does not automatically recompile my TypeScript file if I made a change).
I think the key is getting the Node.js development option installed correctly since I am able to run the pre-packed Angular solution on another PC and the Hot Module Replacement works fine.
Please let me know if anyone has any ideas on how to resolve.
I had a similar, if not the same, issue. Check the Visual Studio installation directory (2017 Professional in this case) for Node:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\NodeJs
If the executable is there, add the directory to your PATH.

How can I set up gulp to run identically in Visual Studio 2017 and msbuild without having to change my build scripts?

I'm struggling to get set up with gulp in Visual Studio 2017. I'm not sure where I'm going wrong but there are a few things I'm confused about and I can't really find any online resources that are of any use.
The build system I'm using is CruiseControl.NET and I would like gulp to work with it.
This is what I've done so far:
Installed Visual Studio 2017 with .NET Core cross-platform development and Node.js development selected (amongst other options).
Created a new project
Added a gulpfile.js file to the project
Right-click on the file and choose Task Runner Explorer
In the Task Runner Explorer I get the error Failed to load. See output window (Ctl+Alt+O) for more information..
Then if I do the following:
Open the Node.js Interactive Window
Run the command .npm install --global gulp-cli
Close Visual Studio and open it back up again
In the Task Runner Explorer, I then get the message (No tasks found).
First off, is this the correct way to set up Gulp in Visual Studio 2017?
The reason I'm asking this is because I'm not sure why I need to prefix commands with a period character (ie .npm as opposed to npm).
I'm also not sure where gulp was installed because I can't find it in the path C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\node_modules.
Because of this I can't really set up CruiseControl.NET.
The way I'm handling this is to first use the Web Essentials 2017 extension. This installs the Bundler & Minifier tool, which then adds a bundleconfig.json file to your project. Right-click on this file, go to the Bundler & Minifier menu item and you will see an option in there to Convert To Gulp.
Selecting convert to gulp will create the necessary gulpfile.js and also install the npm packages required for using Gulp. Wait for all of the npm packages to install and you can then right click on gulpfile.js, select Task Runner Explorer and you should be ready to set up Gulp-based tasks. If you see gulpfile.js failed to load message, npm packages may still be installing (check the progress bar on the VS 2017 status bar). Hit the Refresh icon in Task Runner Explorer when all packages are installed and the error should vanish.
There's probably a more manual way to add Gulp support but I find this more automated method ensures all the tooling is wired up to work properly and I don't miss anything.
I gleaned all this information from the awesome Microsoft Docs site, specifically this page on Bundling & Minification. There's also a Using Gulp section in there that may provide additional details for your situation.
https://learn.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification
Microsoft have now added documentation on how to get gulp running:
https://learn.microsoft.com/en-us/aspnet/core/client-side/using-gulp
Make sure you update Visual Studio 2017 to the latest version as it now comes shipped with Node.js, NPM and Gulp (you don't need to pick "Node.js support" when installing Visual Studio for this to work).
Create an npm Configuration File (package.json) in your project folder and edit it to reference gulp:
{
"version": "1.0.0",
"name": "example",
"private": true,
"devDependencies": {
"gulp": "3.9.1"
},
"scripts": {
"gulp": "gulp"
}
}
In the project folder, create a Gulp Configuration File (gulpfile.js) to define the automated process.
Add the following to the post-build event command line for each project requiring gulp support:
cd $(ProjectDir)
call dotnet restore
npm run gulp
To run the tasks in Visual Studio 2017, open the Task Runner Explorer (View > Other Windows > Task Runner Explorer).
Then on the build server just install Node.js and ensure the path to node is added to the environmental path variable then when the build server builds the project gulp will run too!
I found the solution here. More information on that part of VS from Mads himself.
You have to force Visual Studio run with your Node.js version:
Go to Tools > Options in Visual Studio 2017
Go to Projects and Solutions > External Web Tools
Add the following path: C:\Program Files\nodejs

VS 2015 TACO - build broke on Xcode 8 / iOS 10

Here are the issues I encountered and fixed:
Code signing: downloaded the xcode8.js hook and added the following to build.json, per http://www.dpogue.ca/articles/cordova-xcode8.html:
"ios": {
"debug": {
"developmentTeam": "VZ4B5XSP9U"
},
"release": {
"developmentTeam": "VZ4B5XSP9U",
"codeSignIdentity": "iPhone Developer"
}
}
On my Mac, deleted the ~/.taco_home/node_modules/taco-remote-lib/2.2.1 and .../2.2.0 folders, per https://github.com/Microsoft/remotebuild/issues/5.
On my Mac, tried uninstalling and reinstalling remotebuild, and different versions of node and npm (0.12.9 and 4.6, and respective npm versions).
In Visual Studio, tried changing the targeted Cordova version: 6.3.1, 6.2, 6.1.1, and back to 5.4.1.
No matter what I do though, the build gets stuck either on extracted - Extracted app contents from uploaded build request, or building - Updating platform forever.
Earlier, when I tried opening the Xcode project in Xcode on the Mac, it successfully built and deployed the app to the device. I was then facing issues using WebRTC (using cordova-plugin-iosrtc) and it was giving me privacy violation exceptions. I tried adding the cordova-custom-config plugin and appropriate Cocoa keys (NSCameraUsageDescription and NSMicrophoneUsageDescription) per App crashes with __CRASHING_DUE_TO_PRIVACY_VIOLATION__ when trying to access contacts, and then it stopped working altogether.
Can anyone please advise what are the latest versions of all of the components I should be using to make it work again? Some sources advise to use Node 0.12.9 on the Mac, others 0.12.7; most people claim that with Cordova >= 5.3.3, any Node version should suffice, however using Node 4.6 didn't work either.
Thanks in advance for any help!
Update: After performing the brew update etc. as suggested by Jordan, the remote deploy works, but the build sets "Main interface" setting under project's General tab to "NSMainNibFile~ipad", which causes the app to crash on launch, until I open the project in Xcode and clear that field, then an incremental build creates a functioning app.
This is a known issue with Apache Cordova 6.3.1 and for the Visual Studio tools we've been working on a fix for this. To work around the issue for now, you'll need to perform the following steps:
Add a developmentTeam property to the ios build settings in your project's build.json file (an example is shown below).
Set the build.json file's codeSignIdentity property to the static value iPhone Developer.
Setup a before_compile hook in your project to copy the developmentTeam property into the project's platforms/ios/cordova/build.xcconfig file.
The project's build.json file should look something like the following:
{
"ios": {
"debug": {
"developmentTeam": "DEVELOPMENT_TEAM_NAME"
},
"release": {
"developmentTeam": "DEVELOPMENT_TEAM_NAME",
"codeSignIdentity": "iPhone Developer"
}
}
}
To simplify the process, Darryl Pogue published a sample hook that makes the required changes to the project's build.xconfig file based on the build.json example shown above. To use this hook, copy the sample xcode8.js file to your project's hooks folder, and then modify the project's config.xml to execute it before the compilation step using the following code:
<platform name="ios">
<hook type="before_compile" src="hooks/xcode8.js" />
</platform>
Creating a Distribution Build
At this point, the Cordova build process works, and you can run, test and debug your app. Unfortunately, the app isn't being signed with the correct development certificate needed for distribution. In order to sign them with a distribution certificate, you'll need to create an archive of the app by following the instructions found in: Uploading Your App to iTunes Connect.
iOS 10
Developers building Cordova applications for iOS 10 may encounter the following errors:
Http 404: Error mounting developer disk image
Http 500: No devices found to debug. Please ensure that a device is connected and awake and retry.
This is caused by the Mac development environment needing an update to several modules. To fix the issue, on Mac OS, open a terminal window and issue the following command:
brew update && brew upgrade libimobiledevice --HEAD && brew upgrade ios-webkit-debug-proxy ideviceinstaller

Node.js on Azure Website 500 status

I am trying to get a node.js (meanjs) site running on Azure. The site work on my local environment with no errors. But after deployment when I go to my site I get a 500 error in my network tab in chrome. There are no obvious errors to me.
I used https://groups.google.com/forum/#!topic/meanjs/LrHmE43RSvA to walk me through how to set it up with the azure cli.
It is also setup to deploy form my github.
In the Azure portal the deployment dose not fail. I have read through the log and tried to find a problem but im hardly know where to start. Reading through it there are some things that look weird to me for instance. (The log is long and past the character limit or I would have posted it all.)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [D:\home\site\repository\node_modules\bson\build\binding.sln]
and there are lots of
npm WARN unmet dependency
Then they all get processed and the files get copped to the wwwroot and finishes successfully.
Some of the things i have tried are changing the deployment branch, deleting the website and starting over. I have
Let me know if there is any thing else that I can add to this post I really want to get this working.
Thanks for any help.
Edit**
I added bson to the .gitignore and got a new error. I am also getting some new errors below is what has changed.
bson#0.2.18 install D:\home\site\repository\node_modules\bson
(node-gyp rebuild 2> builderror.log) || (exit 0)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[D:\home\site\repository\node_modules\bson\build\binding.sln]
npm WARN prefer global coffee-script#1.8.0 should be installed with -g
npm ERR! Error: ENOENT, chmod >'D:\home\site\repository\node_modules\flatiron\bin\flatiron'
npm ERR! If you need help, you may report this entire log,
I also added a .npmignore to the directory but it is blank. I have tried adding both the bson and flatiron to the .gitignore but that did not change the error.
From the log you posted, I can see it failed when azure tried to install an NPM module named bson during the deployment, because there's no VC++ compiler in the virtual machine your azure website located.
It worked well in your machine since you have VC++ installed.
To fix, you'd better compile this module (bson) in your machine (x86 or x64 based on which one selected in your azure website), make this module as included under node_modules folder in your .gitignore so that it will be uploaded when you commit your code.
I have a blog post mentioned this problem and I was using Node.js SQL Server Driver as an example. It also needs VC++ compile.
http://blog.shaunxu.me/archive/2012/11/16/install-npm-packages-automatically-for-node.js-on-windows-azure-web.aspx

Resources