I used visual studio to create an node express 4 project. However it cannot run and all the entries under npm show (missing). I cannot find the node_modules folder too.
It doesn't install them automatically. Either run npm install from a command window, or right click on the "npm" item in the project structure and do the install that way. I would recommend doing it through the command prompt though, if you are on a 64 bit machine.
Related
Using: Windows 10, Visual Studio 2022 17.1.0 (soon to be updated).
I come from the age when I would just copy the JavaScript files of a library in a subfolder of my website/application, add some <script...> tag to the adequate pages and call it installed...
But right now I'm trying to initiate my first Angular 2+ project. I'm trying to start from "Standalone TypeScript Angular Project" template.
But Visual Studio won't create my project, it writes in red
ng is needed (...)
npm is needed (...)
So I checked how to install ng... I needed npm, I checked how to install npm... I read it's recommended to install it through nvm... so I installed nmv, then npm, then ng ( v16.15.1 )... but Visual Studio still won't create my project and keeps requiring npm and ng.
What am I missing?
(I tried searching the Internet but mostly found a bunch of unrelated references and dead links.)
Here are the precise things I ran so far:
nvm-setup.exe
(I installed it in a custom folder of D:\ as I want this kind of tools to go there.)
nvm install lts
This installed npm in a subfolder of my customer folder.
npm install -g #angular/cli
This installed ng in a the same folder as npm + a subfolder.
I added '[...]/v16.15.1' (which contains npm.cmd, ng.cmd and node.exe) to the PATH "environment variable", but the problem remains unchanged.
Solved: after previous step, I needed to restart Visual Studio, but as I kept re-launching Visual Studio from Visual Studio Installer, it didn't work as a restart. Effectively closing the Installer and just relaunching Visual Studio refreshed things and it finally worked.
Solved: I needed to add the path that contains npm, ng and node to Windows "user and/or system Environment Variables".
And I also needed to restart Visual Studio (including closing Visual Studio Installer).
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.
I am trying to install gulp on my development Windows 10 Pro machine and it is not working. I have installed node.js and when I use my admin account I can run gulp. However, when I am not an admin, Windows cannot find the library.
Additional details:
I have looked at Can't install gulp on windows 10 and have searched the web with no luck.
Using Visual Studio 2015 and the project uses gulp to generate css sass and minify js files.
When I run npm install gulp -g -verbose I get (eventually) the following output:
Have you tried cleaning npm cache. use
npm cache clean
And if that doesn't work try installing gulp locally just for that project.
npm install gulp
The screenshot you provided, there is one line where is written that you have not correctly created json file.
package.json should be actual JSON not JavaScript
can you provide your package.json file?
I was manually updating node and npm. I am using them from Visual Studio only. Typing any npm command e.g.
npm --version
causes the process to hang and CPU consumption goes max. So I cannot uninstall or reinstall npm with npm commands. Node seems to work fine. I am using Node version 6.3.1 and it responds normally to
node --version
Calling
where node
gives only one result.
What I have done so far:
Upgraded Node.js outside VS2015 using command prompt.
Uninstalled Node together with npm from command prompt.
Deleted Node program folder and all subfolders
Uninstalled Visual Studio 2015
Installed VS 2017 RC.
Even after this last step, the behavior of npm is the same - it hangs. Visual Studio refuses to build at all.
I hope my problems will be solved when npm starts to work again. So I figure next to try is to uninstall npm alone followed by a reinstall. How can I do that without using npm?
Use the following process:
Delete %appdata%\npm and %appdata%\npm-cache.
Edit your PATH and remove everything that references npm (to do so, hit "Start" and search for env).
Reinstall Node, then install this tool - and only use this tool to upgrade npm, do not attempt to run npm install npm.
References
Microsoft NodeJS Guidelines
I am trying to develop a chat app with node.js and socket.io in an eclipse environment. I have installed node.js in eclipse but I don't know how to install node modules such as expresss, socket io, etc.
Please anyone tell me how to setup node modules in an eclipse environment.
From https://groups.google.com/forum/#!topic/nodeclipse/FgUci2ZXpoQ
Double-click package.json on the Package Explorer to open it.
Add into dependencies section what you want to install, and save it.
Select package.json on the Package Explorer, open context menu by right-clicking, and select [Run As]-[npm install] menu.
I dont think that there is an eclipse integrated way to do this. My suggestion is that you download node.js+npm from http://nodejs.org/download/ and then open up a terminal/cmd and in your node.js project directory do "npm install myPackage"
I'm running Eclipse Mars... Here is how I did it...
Install Nodeclipse from eclipse marketplace http://www.nodeclipse.org/
Create a new node.js express project, File -> New Node.Js Express Project
Open the package.json file
Add my npm package to the package.json as a dependency (copy the format for the express dependency)
Save the package.json (seems obvious but it got me when testing!)
Right click the package.json, Run As -> NPM Install
Right click the eclipse project folder, Refresh
Open node_modules... BOOM! You will see your new module installed in eclipse
You mention installing express, but you don't need to install that if you're using nodeclipse.
to generate an express project:
Select the File-New-Project menu.
Select Node-Express Project, and select Next button.
Enter Project name and select Finish button.
To install express modules in Nodeclipse go to
Windows -> Preferences-> Nodeclipse -> choose express path field
and enter the location of the installed express on your localhost.
Navigate to your project folder via command prompt. Once there, run the npm install 'module' command. After the module installs, refresh your project in eclipse. A javascript library should show up in your project containing the library of the module you just installed. Run your code and it should work and recognize the modules that your are trying to require.
Hope this helps.