- I loaded an existing project that worked fine without nodejs tools
- `npm install` had already been performed
- I created a nodejs tools project for this folder
- In Solution Explorer, the npm node was empty
- Right-click npm > manage npm modules
Error: Unable to parse package.json from your project. Please fix any errors and try again.
- I decided to delte my `node_modules` folder and open the project again
- When I tried to delete the node_module the OS complained about a file begin too long:
```
d:\sources\myproject\Sources\WebServices\static\node_modules\grunt
-jscs-checker\node_modules\lodash.assign\node_modules\lodash._basecreatecallback\node_modules\lodash
.bind\node_modules\lodash._createwrapper\node_modules\lodash._basecreatewrapper\node_modules\lodash.
_basecreate\node_modules\lodash._isnative\
```
- I deleted the folder using the [robocopy trick](http://superuser.com/questions/45697/how-to-delete-a-file-in-windows-with-a-too-long-filename)
- I reloaded the project and this time, the npm folder was able to show the dependencies with the *missing* indication.
- I launched Update npm modules command from the npm node in Solution Explorer
- The end of the log is:
```
npm http 304 https://registry.npmjs.org/estraverse
npm http 304 https://registry.npmjs.org/esshorten
npm http 304 https://registry.npmjs.org/escope
====npm command completed with exit code 0====
Error reading package.json at 'D:\sources\myprojecy\Sources\WebServices\static\package.json': Unable to read package.json. Please ensure the file is valid JSON.
Reading failed because the following error occurred:
Reading failed because the following error occurred:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
Caused by:
Unable to read package.json. Please ensure the file is valid JSON.
Reading failed because the following error occurred:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
Caused by:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
```
- So think there is an issue with the npm features and long file names.
Comments: Just out of interest, I believe the ´blame´ is equally shared between Windows and the structure used for node_modules. Some of the paths are just unbelievably long, and include some bizarre situations where I found, at the end of a huge folder structure, three folders arranged under each other named ´deep´, ´deeper´, ´deepest´, the last containing an empty text file named ´deepest.txt´. While it is true that Windows has had an unresolved issue for decades, that is obviously causing pain, there must be a simpler way to manage dependencies in node packages. It seems strange to me that people are proclaiming NPM / Bower etc. as inherently superior, but I have to constantly search for work around, temporary patches etc to make them work, whereas NuGet ´just works´.
- `npm install` had already been performed
- I created a nodejs tools project for this folder
- In Solution Explorer, the npm node was empty
- Right-click npm > manage npm modules
Error: Unable to parse package.json from your project. Please fix any errors and try again.
- I decided to delte my `node_modules` folder and open the project again
- When I tried to delete the node_module the OS complained about a file begin too long:
```
d:\sources\myproject\Sources\WebServices\static\node_modules\grunt
-jscs-checker\node_modules\lodash.assign\node_modules\lodash._basecreatecallback\node_modules\lodash
.bind\node_modules\lodash._createwrapper\node_modules\lodash._basecreatewrapper\node_modules\lodash.
_basecreate\node_modules\lodash._isnative\
```
- I deleted the folder using the [robocopy trick](http://superuser.com/questions/45697/how-to-delete-a-file-in-windows-with-a-too-long-filename)
- I reloaded the project and this time, the npm folder was able to show the dependencies with the *missing* indication.
- I launched Update npm modules command from the npm node in Solution Explorer
- The end of the log is:
```
npm http 304 https://registry.npmjs.org/estraverse
npm http 304 https://registry.npmjs.org/esshorten
npm http 304 https://registry.npmjs.org/escope
====npm command completed with exit code 0====
Error reading package.json at 'D:\sources\myprojecy\Sources\WebServices\static\package.json': Unable to read package.json. Please ensure the file is valid JSON.
Reading failed because the following error occurred:
Reading failed because the following error occurred:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
Caused by:
Unable to read package.json. Please ensure the file is valid JSON.
Reading failed because the following error occurred:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
Caused by:
Additional text encountered after finished reading JSON content: n. Path '', line 40, position 1.
```
- So think there is an issue with the npm features and long file names.
Comments: Just out of interest, I believe the ´blame´ is equally shared between Windows and the structure used for node_modules. Some of the paths are just unbelievably long, and include some bizarre situations where I found, at the end of a huge folder structure, three folders arranged under each other named ´deep´, ´deeper´, ´deepest´, the last containing an empty text file named ´deepest.txt´. While it is true that Windows has had an unresolved issue for decades, that is obviously causing pain, there must be a simpler way to manage dependencies in node packages. It seems strange to me that people are proclaiming NPM / Bower etc. as inherently superior, but I have to constantly search for work around, temporary patches etc to make them work, whereas NuGet ´just works´.