Why is Visual Studio looking for my gulpfile in the wrong folder? - asp.net

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:
Visual Studio 2015 RC Gulp task runner not detecting tasks (All Answers)
https://stackoverflow.com/a/37437209/6425704
Basically the entire first page of Google for "visual studio gulp no tasks found"
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?

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:
Open up Registry Editor. I did it by using the Windows Run tool (Win + R) and typing regedit.
Navigate to HKEY_CURRENT_USER > SOFTWARE > Microsoft > Command Processor.
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.)

Related

Why do I get "sh: next: command not found" when running a cloned nextjs app?

I've cloned a nextjs example repo locally, and tried to run it using npm run dev, but it's not finding "next" as a command?
sh: next: command not found
I googled it, suggestions seemed to be that I should run
npm i -g create-next-app
Which I did, but still get the same error?
How can I resolve this?
For my particular case, I forgot to run npm install in the repo I'd just cloned :D
Once I did that, running npm run dev worked fine and found next.
But I suspect in general if you're trying to run a cloned repo based on npm, and get a similar response, you may simply have forgotten to install your dependencies, like I did.
Note that this can also happen for an existing project if you have some script that removes the node_modules folder as part of a cleanup process (which I do as well)

How to tell Visual Studio Code compiled from source where to find sqlite module?

I am building the Visual Studio Code from the source checked out from the git repository:
git clone https://github.com/microsoft/vscode
I am building using:
export NODE_OPTIONS=--max_old_space_size=2048
./scripts/npm.sh install --arch=armhf
./scripts/code.sh
I am using node 10.16.3 on a Raspberry PI 4, using Raspbian buster
There were no errors during build.
The installation downloads a precompiled version of electron on the first run.
However each time I try and run code, it starts but with an error:
[storage state.vscdb] open(): Unable to open DB due to Error: Cannot find module '../build/Release/sqlite
If I look in node_modules/vscode-sqlite3/build/Release/
I can see:
sqlite3.a
sqlite.a
It is unclear to me why electron/vscode cannot find this library. I would be greatful for any pointers on how to tell the runtime where to look for the modules.
On inspecting the build scripts and after many painful experiments, I've found and solved the 2 problems leading to this error.
The fact that .a static libraries are left behind hinted that some settings in the binding.gyp, config.gpy and/or makefiles are wrong, as Native Node Modules are normally dynamic libraries with an .node extension. One conditional line in the binding.gyp file under vscode-sqlite3 seems to the the culprit:
...
["target_arch=='arm'", {"type": "static_library"}]
...
Disable that line (by removing it or changing 'arm' to something else) and then run:
node-gyp configure
to regenerate the config.gpy file(s) under the build directory. Then build the module with:
node-gyp build
A sqlite.node will be generated in build/Release.
Unfortunately, the latest electron ABI version rarely matches that of the Node.js version. In my configuration, the electron ABI version is 72 (v6.0.12) but the latest stable Node version is for ABI 64. Therefore we have to do an electron-rebuild to update the sqlite.node to match the electron version.
To do this, you would have to first install electron-rebuild (yarn add electron-rebuild) then run electron-rebuild by giving supplying explicitly the version number of the electron binary that vscode downloaded:
electron-rebuild -v 6.0.12 -m /home/dev/vscode -o vscode-sqlite3
Of course you would have to state the version number of your particular version of electron you are building for.
(Please look up electron-rebuild --help for the meaning of the options. It takes a while to rebuild the binary module...)
The resulting sqlite.node can then be moved into the build/Release/. directory under the vscode project directory. Voila, we have a working latest version VS-Code for Raspbian!

mup deploy works but image won't start

I'm deploying my Meteor app with mup from a Windows 10 box to a Digital Ocean VPS. Latest version of mup, latest version of meteor, app runs fine on Windows and the app deployed and ran fine before adding node-uber NPM. I see the following error in the logs when the app tries to start:
npm ERR! enoent ENOENT: no such file or directory, chmod '/bundle/bundle/programs/server/npm/node_modules/node-uber/node_modules/sshpk/bin\sshpk-conv'
Obviously the problem is with the backslash in the filename, but not sure where that is coming from or how to fix it. It isn't referenced in the package.json for node-uber. I've tried editting the package.json for sshpk on the Windows side, but that doesn't make any difference. I can't edit the file in the Docker container because the container keeps restarting and kicking me out.
Anyone have any suggestions on how to fix this, perferably permanently so I don't have to jump through hoops every time I deploy?
Actually manually editting the package.json file does solve the problem. Turns out I have multiple copies of sshpk installed because the parent NPMs are specifying specific versions as being required.
So the "fix" for this problem is the edit the "bin" section of the sshpk package.json file to flip the "\" to "/", save and rerun mup deploy.
Sigh...

Meteor 1.4.1 release not functional on Windows

I tried to install Meteor on another system. Installation go well, then I copied my project and I am running meteor run but
"Extracting meteor-tool#1.4.0-1" it is happening forever. Then I tried to update version number to 1.4.1 and run again "meteor run". Now I do not need to install 1.4.0.1 so it worked but got stuck on extracting on other modules.
Possible reasons can be extraction program of this is release is faulty. Would someone suggest a solution or how can I download 1.4.0.1 release of meteor directly?
https://github.com/meteor/meteor/issues/7688
I found the answer of this problem. This is problem with tar extractor.
I installed the newest 7zip and renamed the tar.exe in my GIT program folder ("where tar" command in cmd revealed, that somehow that exe was associated with .tar archives) to tar.exe.old.
If you can not find where is tar then run "where tar" command to get path of tar.exe
This solves the problem.
Take a look at this answer: https://stackoverflow.com/a/40122752/6861101
Try adding the following to your local hosts file (C:\Windows\System32\Drivers\etc\hosts):
54.192.225.217 warehouse.meteor.com
Then run a meteor reset in your app directory (warning - will wipe your local DB), then try starting your app again.
This worked for me.

Running 'grunt' command on mean.js app just stalling

I am following the installation guidelines as described on mean.js.org Everything seemed to install fine. I have all prereqs installed. I ran npm install after cloning the github repo and then tried to run grunt and I didnt get any errors however It seems to just be stalling on the command line. Last message on the command line is the "debugger is running on port 5858" and then it just sits there.
After some time the message [nodemon] watching 51,839 files - this might cause high cpu usage. To reduce use "--watch" comes up. I am on windows 10 and have all the latest versions of node,npm,grunt and mean.js. I am running the command line as admin.
Mean.js should be running on localhost:3000 but it is not.
This is intended.
There is an application invoked by the grunt command and running in background, watching your files for changes. In default configuration: nodemon and grunt-watch.
This will execute specific tasks based on the files you edited, such as linting JS files or compiling LESS files.
The cmd will probably show something when you edit files in the projects directory.

Resources