Visual Studio Code's Intellisense does not recognize npm-installed package - node.js

I recently began studying NodeJS using VSCode, and it turns out that Intellisense does recognize the methods of core Node modules (fs, http, os etc.), but not those belonging to an npm module which I installed by myself, using the npm install command (the pack: validator).
When chained with .default, however, Intellisense does accurately provide the methods belonging to the package.
Has anyone else encountered this issue when working with VSCode and NPM?

Related

gulp integration in Visual Studio 2017 not working

I'm attempting to get gulp integration into Visual Studio 2017. It's working on the command line. The Task Runner Explorer in VS2017 is telling me Failed to load. See output window.
The Output Window is telling me the following:
Failed to run "<ProjectPath>\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
<ProjectPath>\node_modules\node-sass\lib\binding.js:15
throw new Error(errors.missingBinary());
^
Error: Missing binding <ProjectPath>\node_modules\node-sass\vendor\win32-x64-47\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 5.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 8.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
I attempt to run npm rebuild node-sass --force, only to be told Error: Can't find Python executable "C:\Python36\python.EXE", you can set the PYTHON env variable., which I confirmed existed.
I'm not sure how much farther I want to go down this rabbit hole. It appears to be a VS issue since everything works as expected on the command line. I'd like to get the gulp integration with VS working correctly.
Point your VS tools to the node installation on your path.
I can see in the error that there a version discrepancy between 5.x and 8.x - with VS likely being the older one (since it ships with pre-packaged and outdated node) and is taking execution precedence with the default setup.
I'm guessing you installed node-sass via your 8.x (external command line) instance but VS is trying to execute your gulp tasks via your VS's internal 5.x. node-sass leverages node-gyp to build a binary via installation scripts, and there will be incompatibilities across versions. In other words, this package, and many others that build binaries, are specifically tailored to the version of node it was installed against. To summarize, everything in node_modules/.bin is built against 8.x but is actually running on 5.x when you do so through Visual Studio.
Fear not, this is easily solved. Check out this answer for some historical context on this long running issue that many face. Basically, you want $(PATH) to be at the top of this list so your OS installation is always used...
Once you do this (just to be safe) - blow away node_modules, reinstall, and happy coding. VS really needs to stop shipping with pinned versions of node...
I ran into this problem on both Visual Studio 2017 and 2019. Apparently my Node install wasn't registered in the PATH variable (and I don't have permission to modify this on my work machine), so I manually added the link to Node at C:\Program Files\nodejs, moved that to the top location and that worked for me.
This drove me nuts until I found one more missing thing. Even if you configured everything as in the other answers you can get the same error, possibly if your user folder is not on the same drive as where Node is installed. Then also add %APPDATA%\npm to the external tools paths so globally installed Node tools will be found too.
So all in all the external tools config in VS should contain these two paths first, in this order:
C:\Program Files\NodeJS (or where you have Node installed).
%APPDATA%\npm
For me without #2 everything was working from the command line everywhere but not in VS. With it added everything now works in VS too.

Set version Info does not exist error after installing MSBuild Extension Pack for DotNetNuke module creation

The PC at work finally kicked the bucket and I needed to install MSBuild Extension Pack on my new PC so that I could continue creating DNN modules for my website. For whatever reason after I install it, I am getting the same error as if it is not installed
Set version Info does not exist in project c:\users\...
Here is what I have tried:
Uninstalling and reinstalling
Restarting computer and VS several times
Starting new project and trying to build it (gives same error)
Looking online for documentation and/or videos on how to install this properly (no luck)
My current version of windows is win7 x64 and the version of DotNetNuke that I am creating modules on is DNN 6.2.5. The version of MSBuild I have installed is 3.5.14 and 4.0.11. I am using VisualStudio 2012.
Did I miss a step in installation? Should I have used Community tasks?
After several restarts (and several rinse and repeat of the above 'tried' list), I installed MSBuild.Community.Tasks.v1.4.0.00.msi. After installing this my module template was able to build the project without error. Unfortunately, due to lack of documentation I do not know if you need both the extension pack AND community tasks in order for this to work, only that community was necessary in this case. For this reason I will leave the extension pack installed for now.

Install bcrypt without Visual Studio

I'm trying to install bcrypt via npm and I'm getting a Failed at the bcrypt#0.7.8 install script. error.
I'm on Windows 8 x64, node ver 0.10.29.
Looking at bcrypt's dependencies tells me I need node-gyp, which apparently needs visual studio 2012 and python. For real? Do I really need to install a full IDE that I'm not going to use for this one node module?
Is it the compiler node-gyp is after, or some other small component from VS I can install that will do the trick?
Would love any suggestions for how to get this working with minimum possible extras.
As previously mentioned, you can install VC++ Express (and the Windows SDK) for free. However, if you are really that bothered by it, you could use a bcrypt API-compatible module that is implemented in pure javascript, however you will see a performance hit.
I should also note that there are many (useful) modules on npm right now that require compilation, so chances are you'll be getting more use out of the compiler (in the future) than you think.

node-webkit native module with dll

I'm using node webkit with the node webkit hipster seed
I have build a native C++ module, using the Leap Motion SDK, which compile and work fine with node-gyp.
Now I'm trying to implement it on node webkit, but I always get "Error: no error" when I require my module. (Yes, it's recompiled with nw-gyp)
I was getting the same error when I was trying my module with node-gyp without leap sdk dlls, so I try to move my dlls in the module build directory, and in the application build directory, but no effect.
I'm using Windows 8, but I will also build on OSx
Strangely, it work by renamming the executable to nw.exe, thanks to https://github.com/geo8bit/nodebob/pull/7

Getting sqlite3 on clients computer without needing them to compile and install libraries

I need to build a self contained appjs application with sqlite3, for win xp 32bit.
I myself am running windows 7 32bit and have not been possible to install sqlit3 via npm. I've tried installing all the gyp and correct python code, the errors are numerous and never ending.
Is there a way I can get a zipped version of the sqlite3 node modules for win32 that is precompiled/built so I can A) use it on my system for development and B) give the client without them needing to run any setups?
EDIT I've been googling around reading stuff like building sqlite3 for windows is a nightmare & this https://github.com/developmentseed/node-sqlite3/issues/55 has been linked a few times. Will my client be able to run the app without having to install visual studio or python or is that just the requirement? If so is there any other database that can be self contained without running a database server?
Just use a pure Javascript implementation of SQLite like SQL.js

Resources