4

Backstory

I've been trying to set up a project in Visual Studio, which uses GulpJS to compile Sass. I was told that VS should automatically recognize the package.json inside a project and run npm install, but I had to do that manually through a command line. Even then, when I opened Task Runner Explorer, it says that there are (No tasks found). My coworker and I looked up solutions that worked for other people, many of which reported having success after restarting VS, clearing some cached data, or reinstalling the node modules; however none of those worked for me. Here are some solutions I've attempted:


The Problem

After some digging, I came across the Package Manager Console and decided that maybe I can run gulp through that instead of opening a separate CMD window. However, when I did, I got the following:

[11:27:43] Local gulp not found in C:\
[11:27:43] Try running: npm install gulp

My immediate thought was that I might need to reinstall the dependencies, so I ran npm install and got this output:

npm : npm WARN enoent ENOENT: no such file or directory, open 'C:\package.json'
At line:1 char:1
+ npm install
+ ~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (npm WARN enoent...:\package.json':String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data

npm

WARN
 !invalid#1 No license field.

This is when I noticed that it is looking for C:\package.json instead of the one inside my Project directory. However, when I ran ls, it clearly shows that it's inside the Solution root, at C:\Dev\solution-name. I tried navigating to the specific Project, using cd Presentation\Nop.Web, but I still get the result of it looking in the C:\ root. Can anyone explain why this is happening and how I can fix it?

Community
  • 1
  • 1
Quangdao Nguyen
  • 1,343
  • 11
  • 25

1 Answers1

1

I finally figured it out (one more day, and I would've offered a bounty for this question), and it's not a problem with VS. Back when I first started using this specific computer and was still using Windows' default Command Prompt, I didn't like it starting in %USERPROFILE% by default. So I looked for a way change the default and stumbled upon a registry "hack" which essentially runs cd C:/ on cmd.exe startup. However, it turns out that this causes other command line tools, including Powershell and VS's Package Manager to run that command.

If anyone else is experiencing this issue (which, due to the nature of this situation, I doubt anyone has), you can try following these steps:

  1. Open up Registry Editor. I did it by using the Windows Run tool (Win + R) and typing regedit.
  2. Navigate to HKEY_CURRENT_USER > SOFTWARE > Microsoft > Command Processor.
  3. Remove AutoRun (or change its value to something that won't interfere with your workflow).

More info here.

Original Registry Tutorial (Note that if I had scrolled down a bit more, I might have avoided this situation.)

Community
  • 1
  • 1
Quangdao Nguyen
  • 1,343
  • 11
  • 25