Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio 2015 crashes with many packages to download #336

Closed
sondreb opened this issue Jul 30, 2015 · 8 comments
Closed

Visual Studio 2015 crashes with many packages to download #336

sondreb opened this issue Jul 30, 2015 · 8 comments

Comments

@sondreb
Copy link

sondreb commented Jul 30, 2015

Creating a new project, then modifying the package.json adding all of these packages, then saving, will eventually make Visual Studio crash. I'm using the "Basic Azure Node.js Express 4 Application" template. This does not happen with the ASP.NET 5 beta 5 project template:

  "dependencies": {
    "angular": "1.4.3",
    "angular-animate": "1.4.3",
    "angular-aria": "1.4.3",
    "angular-material": "0.10.0",
    "angular-ui-router": "0.2.15",
    "angular-winjs": "3.1.1",
    "angular-resource": "1.4.3",
    "hammerjs": "2.0.4",
    "winjs": "4.1.0",
    "jquery": "2.1.4"
  },
  "devDependencies": {
    "browser-sync": "2.7.13",
    "browserify": "10.2.6",
    "chai": "^3.0.0",
    "del": "^1.2.0",
    "event-stream": "3.3.1",
    "gulp": "^3.9.0",
    "gulp-concat": "2.5.2",
    "gulp-csslint": "0.1.5",
    "gulp-env": "0.2.0",
    "gulp-folders": "1.1.0",
    "gulp-if": "1.2.5",
    "gulp-imagemin": "^2.3.0",
    "gulp-import-css": "0.1.2",
    "gulp-jshint": "1.9.2",
    "gulp-load-plugins": "1.0.0-rc.1",
    "gulp-minify-css": "1.2.0",
    "gulp-order": "1.1.1",
    "gulp-rename": "1.2.0",
    "gulp-sass": "2.0.3",
    "gulp-shell": "0.4.2",
    "gulp-size": "1.2.3",
    "gulp-sourcemaps": "1.5.2",
    "gulp-uglify": "1.2.0",
    "gulp-util": "3.0.6",
    "gulp-watch": "4.2.4",
    "ini": "1.3.4",
    "jasmine-core": "^2.3.4",
    "karma": "^0.12.37",
    "karma-chai": "^0.1.0",
    "karma-chrome-launcher": "^0.2.0",
    "karma-jasmine": "^0.3.6",
    "karma-mocha": "^0.2.0",
    "karma-phantomjs-launcher": "^0.2.0",
    "karma-requirejs": "^0.2.2",
    "mocha": "^2.2.5",
    "phantomjs": "^1.9.17",
    "run-sequence": "^1.1.1",
    "vinyl-buffer": "1.0.0",
    "vinyl-paths": "^1.0.0",
    "vinyl-source-stream": "1.1.0"
  }

Then opening the solution and project after crash, simply throws a bunch of errors in the Output window:

System.AggregateException: One or more errors occurred. ---> Microsoft.NodejsTools.Npm.PackageJsonException: Error reading package.json at 'C:\Source\Temp\ExpressApp1\ExpressApp1\node_modules\gulp-sourcemaps\node_modules\through2\node_modules\readable-stream\package.json': Unable to read package.json. Please ensure the file is valid JSON.

Reading failed because the following error occurred:

Unterminated string. Expected delimiter: ". Path 'repository', line 22, position 9. ---> Microsoft.NodejsTools.Npm.PackageJsonException: Unable to read package.json. Please ensure the file is valid JSON.

... This is because a lot of files was stopped writing mid-file, so they are destroyed.

Downloading ONLY the dependencies, and not the devDependencies, works fine. Downloading half of the devDependencies, makes Visual Studio 2015 RTM consistently crash.

Clean Windows 10 RTM installation with Visual Studio 2015 with Tools released 29th of July.

@sondreb
Copy link
Author

sondreb commented Jul 30, 2015

I do think the Visual Studio crash happens due to the Node.js analysis refresh operation that the Node Tools does. This starts during npm install and it crashes Visual Studio after a short while.

When it crashes Visual Studio, it can actually make NPM packages corrupt on the local machine, and this can even happen in the npm-cache folder. This means the next time a user tries to install the package, it will actually fail unless "npm cache clear" first is run.

https://connect.microsoft.com/VisualStudio/feedback/details/1608439/npm-cache-should-purge-when-repeating-errors-occurs

Is it possible to DISABLE the Node.js analysis somehow? And perhaps enable after packages have been restored?

@sondreb
Copy link
Author

sondreb commented Jul 30, 2015

I do think the issue is related to paths to long for Windows, one of the times I manually added one and one package, it failed on gulp-imagemin. When I now tried to delete that folder, I got path to long error in File Explorer.

Please inform what options to disable in Visual Studio to make sure it won't crash during npm install. For now I can't use this add-on.

@mousetraps
Copy link
Contributor

Hmm, unfortunately I can't repro on my machine.

Since VS crashed, there should be a corresponding entry in the Windows event viewer. Mind grabbing the relevant info so we can track this one down?

@Energiz0r
Copy link

I have the same problem here. But as an extra "bonus" it takes Visual Studio 5 an extra minutes to open the project / solution. I have a different project than sondreb, but I think it still relates to the same problem.

We have reproduced the error on multiple machines, all freshly installed Win 10 machines with VS 2015 Professional.
We use Emberjs for our projects(and it contains some dependencies), and it's easly reproduced by creating a new emberjs project with ember-cli (http://www.ember-cli.com/) and adding the project into a "Blank Node.js Web application"

Before i do a "npm install" and "bower install" VS starts up just fine within 10 seconds.
When I do a "npm install" and restarts VS it takes a couple minutes to open the solution, and after the project is loaded, it only takes a couple of minutes before CPU starts revving up and the memory usage to spike

node_modules and bower_modules are excluded from the project.

I do get an exception in the output, but not sure if it is the root cause

Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject. ---> System.ArgumentException: Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject.
   at Newtonsoft.Json.Linq.JObject.ValidateToken(JToken o, JToken existing)
   at Newtonsoft.Json.Linq.JContainer.InsertItem(Int32 index, JToken item, Boolean skipParentCheck)
   at Newtonsoft.Json.Linq.JObject.InsertItem(Int32 index, JToken item, Boolean skipParentCheck)
   at Newtonsoft.Json.Linq.JContainer.AddInternal(Int32 index, Object content, Boolean skipParentCheck)
   at Newtonsoft.Json.Linq.JContainer.Add(Object content)
   at Newtonsoft.Json.Linq.JTokenWriter.AddValue(JValue value, JsonToken token)
   at Newtonsoft.Json.Linq.JTokenWriter.WriteNull()
   at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)
   at Newtonsoft.Json.JsonWriter.WriteEndObject()
   at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)
   at Newtonsoft.Json.JsonWriter.WriteEnd()
   at Newtonsoft.Json.JsonWriter.AutoCompleteAll()
   at Newtonsoft.Json.Linq.JTokenWriter.Close()
   at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Microsoft.NodejsTools.Npm.ReaderPackageJsonSource..ctor(TextReader reader)
   --- End of inner exception stack trace ---
   at Microsoft.NodejsTools.Npm.ReaderPackageJsonSource..ctor(TextReader reader)
   at Microsoft.NodejsTools.Npm.FilePackageJsonSource..ctor(String fullPathToFile)
   --- End of inner exception stack trace ---
   at Microsoft.NodejsTools.Npm.FilePackageJsonSource.WrapExceptionAndRethrow(String fullPathToFile, Exception ex)
   at Microsoft.NodejsTools.Npm.FilePackageJsonSource..ctor(String fullPathToFile)
   at Microsoft.NodejsTools.Npm.DirectoryPackageJsonSource..ctor(String fullDirectoryPath)
   at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
   at Microsoft.NodejsTools.Npm.SPI.NpmController.<RefreshAsync>d__32.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.NodejsTools.Npm.PackageJsonException: Error reading package.json at 'C:\Project\Failme\failhardvs\failhardvs\node_modules\ember-cli\node_modules\npm\node_modules\graceful-fs\package.json': Error reading package.json. The file may be parseable JSON but may contain objects with duplicate properties.

I see that there is a duplication in the "graceful-fs" module package.json file, but I have no problem starting up the server, or opening the project in WebStorm or Code.

@Energiz0r
Copy link

BTW: If i make a Empty ASP.NET Web project and places the entire emberjs project in that solution it works as expected.

@ghost
Copy link

ghost commented Sep 17, 2015

Energiz0r- check your .ntvs_analysis.dat file. I had a glitch in mine, and it was over 200 meg. Erased started again.

@mousetraps
Copy link
Contributor

Closing - the crash is likely a duplicate of #361 and the errors in the Output Window look like a duplicate of #208, but lmk if you think otherwise so we can re-open. One thing that would be helpful to verify is to see if the corresponding log for the crash in the Windows Event Log matches the one in #361.

@Energiz0r regarding the project load perf issue, would you mind trying RC2 or our latest dev build? We fixed some issues with that. http://github.com/Microsoft/nodejstools

@Energiz0r
Copy link

@mousetraps Just tried RC2.
It works alot better now. Startup time is as expected(same as other VS projects) :) I will revisit this tool, and maybe use it in the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants