New Jode.js project in visual studio: Missing NPM - node.js

I'm going through a basic tutorial on how to create a Node.Js project in Visual Studio. I create the project and there is an "npm" folder with some packages listed such as : body-parser, cookie-parser, etc. They all have "(missing)" next to them. I've gone through this new project setup a few times. Sometimes when I right click on the package the "Install npm Package" is greyed out. Sometimes it isn't. When it isn't and I select "Install npm package", it does absolutely nothing.
This is a new project. There is no Git repository or anything. This is literally just a new Node.js project straight out of the box. Does anyone know why these npm packages are missing or why I can't install them?

I found this, which isn't related to Sisual Studio, but someone trying to install express via the command line:
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
I found some stuff in the logs about a local cert not found. I had to run npm config set strict-ssl and suddenly it worked.
An alternative answer that was suggested is the following, if you are looking for a better long-term solution:
npm config set registry http://registry.npmjs.org/

Related

npm ERR! cb() never called in windows10

I was trying to run npm install inside the project folder but every time there is this error showing npm cb() never called.
I am using node version 10.16.2 and npm version 6.9.0 in windows 10
I have tried npm cache clean --force but that didn't help
E:\contribution\contribute-to-open-source>npm install
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\papun\AppData\Roaming\npm-cache\_logs\2019-08-10T03_51_20_512Z-debug.log
I had the same problems and lost hours trying to solve it :(.
But then i found out that my firm has installed some new kind of firewall with self signed certificate.
Quick solution was:
npm config set strict-ssl=false
After that everything started working without 'npm cb() never called' errors
I had faced the same issue, and i spend days to get a solution for the issue. In the end, i figured it out and it was an issue with my network.
Please verify your network connection and proxy settings.
In my case, I was using corporate proxy using a script. When i opened the pac file and get the proxy from there ( take XXX:XXX from the line return "PROXY XXX:XXX;";) and added to npm config proxy setting (npm config set proxy XXX:XXX), it started working and got resolved.
run this all issue will be solved..
npm install --global windows-build-tools
try to set your proxy using the commands
npm config set proxy http://proxy_host:port
npm config set https-proxy https://proxy_host:port
I have deleted all the node_modules, package-lock.json but still it was not working. For me the reason was, there were some modules that required relogin to install.
So, I deleted my node_modules, build and package-lock.json. and opened command prompt in admin mode.
Then went to the specific project path and logged-in to the components that require credentials.
1. npm login (root path of your react app)
2. type username as "<xxxxx>"
3. type password as "<yyyyy>" (won't be visible on console)
4. type email as "<zzzz>#<aaa>.com"
5. npm i
6. npm run build
It worked for me.
I also faced the same problem I deleted that file from
C:\Users\Harshk1311\AppData\Roaming\npm-cache\_logs
And problem solved
Double Check file name in terminal where error occured and delete file
i.e C:\Users\Harshk1311\AppData\Roaming\npm-cache_logs\2019-08-10T03_51_20_512Z-debug.log
Delete 2019-08-10T03_51_20_512Z-debug.log only this file .
Another possible reason that solved the problem in my case:
Missing MS VC Redistributable. For example if you are on a fresh new PC. In this case you could download the e.g. VC_redist.x64.exe and install it. You may need to restart the terminal before e.g. executing npm i again.
The Visual C++ Redistributable installs Microsoft C and C++ (MSVC) runtime libraries. These libraries are required by many applications built by using Microsoft C and C++ tools.

Unable to build native packages for node

So Im running an Electron app that has some native modules of one them being a package called better-sqlite3. I run yarn and yarn is able to install all packages without a problem but when it gets to the building steps, everything breaks.
I get a bunch of diffrent node-gyp error outputs of which 2 I have been able to save so I can show here here is the important part of the error output for the first error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\bepop\Documents\DeveloperData\Clippy\app\node_modules\better-sqlite3\build\deps\action_before_build.vcxproj]
Full error
In terms of this error I've tried doing multiple things such as installing microsoft visual build tools in many diffrent ways such as manually going to their website and downloading the IDE, I've also tried installing the build tools through NPM with:
npm install --global --production windows-build-tools
It always succesfully installs the build tools but still it errors out on me, I've also tried editing the npm config with:npm config set msvs_version 2017
still doesnt work. I have also tried going to the installation of the Visual Studio and manually checking: "VC++ 2017 version 15.7 v14.14 latest v141 tools"
Also nothing.
I do remember at some point I was able to get everything to build normally with Windows 10 and I never had a problem but not anymore. I've been trying to fix this issue by myself for months now and I've just been sticking on working on the project on my macbook where it never has issues building the better-sqlite3 package.
1 more thing I have tried is completely wiping my computer from everything and starting fresh because at some point i had changed so many things that I lost track of what I had installed and what I did not.
If I remove the better-sqlite3 package from the package.json file everything runs smoothly and I am able to run my project normally but I need the better-sqlite3 package. I could use another package but I really shouldnt have to do that, I'd like to get to the bottom of why this i snot building.
Edit:
Updated: I added Microsoft build tools v14.0.23107.0 to my pats variable and now it outputs error:
C:\Users\bepop\Documents\DeveloperData\Clippy\node_modules\integer\build\integer.vcxproj(21,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Fixed the issue for myself:
Delete node modules folder
Open PowerShell with admin privileges and run in order
npm install --global --production --vs2015 --add-python-to-path windows-build-tools
npm install --global --production --add-python-to-path windows-build-tools node-gyp
Go to ~/.npmrc and make sure these are your settings:
msvs_version=2015
python=python2.7
First remove all the visual studio version installed from your system , and also remove the entries from path and system variable .
and follow the below URL
https://github.com/nodejs/node-gyp#readme
Every thing run fine after removing of better-sqlite3 this package entry from package.json because other packages don't have any native dependency . and this better-sqlite3 is native module after downloading, this module get build using tool node-gpy that will need two things installed on your system i.e. python and visual studio .
So try to follow the above URL steps.
it will definitely work.

Not able to install angularJS2 in visual studio behind proxy server

i am not able to start angularJS2 project in visual studio sitting behind a proxy server. the following steps which i have done are
installed node.js - v6.9.4
npm version is 3.10.10
set the npm config as
npm config set https-proxy=http://username:password#companyAddress:8080
and also tried this
npm config set https-proxy=http://"username:password"#companyAddress:8080 and also
i have a package.json file which was downloaded from here package.json file downloaded link
now when i run the following command in the command prompt, navigating to the folder of my project, intially i get a loader like this
then it returns a error like this
I have even tried this npm config set proxy "http://domainName%5Cusername:password#company.com:8080/" as suggested here but it didnt work
I have tried all the blogs mentioned in stackoverflow as well as github, but nothing goes beyond the following steps and nothing resolved my issue.

"Please specify npm or yarn package" in PhpStorm/WebStorm when trying to install a new NPM package

Trying to add a new package I get the error below:
Going over settings everything looks good:
Any suggestions where to look next?
You need to specify the path to npm.
go to settings->Languages and Frameworks->Node.js and NPM and click on the ... alongside Node interpreter and then click on ... beside npm package and give the path to npm, in my case it is /usr/lib/nodejs/npm.
Similar problem happened when I try to install JavaScript library in idea from Linux. I solved this in idea by
install Nodejs plugin, then Node.js and NPM settings can be showed under Languages & Frameworks
under Node.js and NPM settings, in node interpreter item click ..., set npm package: to /usr/share/npm
After then, I can download third-party JavaScript libraries.

ERROR on npm install command

I am new to nodejs and i am trying to use that with visual studio code editor. I am unable to install any packages. Getting this below error. I think its something to deal with proxy.
I have tried couple of solutions provided (e.g. changes the npm config etc) over the web but nothing seems to working
if you are behind a proxy it wont work you out.use this code
npm config set proxy http://myproxyblabla:myport

Resources