Is it possible to update node in only one project? - node.js

I have a big shared project that is setup with a really old version which is what is installed globally on my computer. I want to start a new project with npx create-react-app but in order to run this I need to update node. I know updating node globally will without a doubt cause breaking changes.
Ive found a couple websites that say running npm install -D node#[versionNumber] could accomplish what im trying to do. So I opened the directory of the project im trying to create and ran this (everything seemed like it worked) but when I checked node -v it was still the old version.
Can someone explain this?

+1 For using nvm. I find it helpful to add an .nvmrc file in each project.
For example, in one project .nvmrc will have:
8
and another it will have:
14
Then you can run nvm use or nvm install once inside each project to get the correct nodejs version.

Related

Node & M1 Mac: dyld[]: missing symbol called

i really need your help.
I am having problems with node (v16.8.0) and my macOS with arm processor. Every time i want to run the backend of this project i get this:
dyld[17378]: missing symbol called
I have already followed the whole discussion on this other post.
I tried to do a clean install of node for arm with rosetta2, but if I run node -p "process.arch" I always get x64.
I've also tried with a more aggressive approach:
Removed all Node files, everything, in all folders and subfolder making sure that node was completely uninstalled
Removed the libraries and removed the dependencies
Re-installed Node with brew (using arch)
Re-installed libraries and dependencies
Since I have already removed and reinstalled node 5 times just today, could you please help me to find out how can I solve this problem? Thank you!
Once again, found the solution.
The solution was:
Clean up again everything. This means uninstall and delete all files for: yarn, npm, nvm, and node
Re-install everything via homebrew
Delete all node_modules
Re-run yarn/npm install in the repo

NPM not installing node module

I have an angular project that comes with a package.json file and all the dependencies listed within, but each time I run "npm install", in the terminal, the packages appear to be downloading properly and a node module folder is created in my root folder, but at a certain stage the installation stops without an error message and the generated node module folder disappear from my project. please what do I do?
I can't reproduce your situation, somehow this may not fitable for you.
But I suggest re-install node.js to make sure npm install work correctly.
This link will help to find what version of node.js for you, based on you angular version.
Compatibility list for Angular/Angular-CLI and Node.js
Also, It would be good to manage node.js via NVM(Node Version Manager).

creating angular 8 project on windows 10 creates additional files

Up until a few days ago I have been using an Ubuntu virtual machine as my development environment for Angular and other related projects due to school, however I decided to switch over to windows since I already had node installed along with git and other development tools.
The issue I'm having is when I create an Angular 8 project using the ng new my-app command, additional files are being created in the root directory which never happened while I was using Ubuntu. The files that are being created are Command files (.cmd) and Powershell files (.ps1), along with files with no extension.
These are just some of the files that are created:
Angular 8 project files on windows
If I compare with the file structure of the projects created in Ubuntu (which are the typical angular.json, tslint, etc), I can delete the unnecessary files and the angular app still works. However, whenever I run npm install to reinstall the packages due to some error, these excess files are added again and I have to delete them every time.
I have tried uninstalling angular/cli and clearing cache using npm cache clean --force and installing angular/cli again but the problem persists. I have also tried removing node and installing it again to no avail.
I'm fairly new to angular and node.js, with only a few months experience from school projects, so I'm currently trying to learn more. I've tried searching using different terms but nobody seems to have encountered a similar problem. Any help is much appreciated.
These are the files that are found in the node_modules/.bin subfolder after npm install is done.
There is something wrong with your npm install. I would recommend uninstalling node, and making sure everything is removed (path variables, files in your user folder) and then reinstall it.

Cannot find Typescript using NVM

I have nvm installed and recently fixed an issue with a conflict with a previously installed version of node. Fixing it meant removing the node executable from the prior location. Some things still work but I'm getting this error:
Cannot find module 'typescript'
and this fix didn't help me:
How to fix Cannot find module 'typescript' in Angular 4?
running ng new is what is triggering the error.
I have typescript installed globally. And to ensure that is installed with this version of node, I ran:
nvm use 10 && npm i -g typescript
/Users/username/.nvm/versions/node/v10.16.0/lib/node_modules/typescript/bin/tsserver
Thanks,
Wayne
When using nvm, every node version has it's own globally installed dependencies. If you are not finding something you have installed previously for a different version of node (or you have removed it), this can be a reason.
For anyone coming across this question, I found the answer here.
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
I had to do all of the steps in the most accepted answer. I also had to:
rm -Rf /user/local/bin/node_modules
It might be a good idea to search your machine for all node_modules folders and, of course, ignore any "local" versions. And delete all of them that are not in your nvm directory. That directory will look somehting like:
/Users/username/.nvm/versions/node/v#####/lib/node_modules
You can identify yours using:
npm root -g

Installing and Using Node JS in My Project

Im very very new in NodeJS
I want to ask about installing and using it in my Project..
I've installed nodejs in my Windows, but I have no idea how to make it works in my Cordova/Phonegap Project. I want to install this module in my project node-gcm. it said I just have to execute npm install node-gcm --save but I dont know where should I execute that command so I tried executed it on my project root (/www). After that I tried the example application code to use it but It said that require is not defined. Can anyone tell me how to fix this?
You need to learn nodejs properly to use in your project. I would recommend the below site could be a good starting point for you which covers all the basics.
http://www.tutorialspoint.com/nodejs/
You are getting that error because, when you look at the package.json file of the node-gcm package, you will notice the dependencies mentioned as,
If you are a windows user, you need to get into your node_modules directory by giving cd node_modules command in your command line and then just issue this command npm install which will install all the required packages.
Hope this helps!.

Resources