creating angular 8 project on windows 10 creates additional files - node.js

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.

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

Is it possible to update node in only one project?

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.

Bundling errors after updating an npm package in React Native app

I'm building a React Native app which, at this point, doesn't have too many dependencies.
Every time I update an outdated npm package, I am GUARANTEED to run into bundling errors. It could be any package. I then spend hours trying different ways to clear npm cache, project cache, etc.
Does anyone else have this issue? Is there a "standard" set of commands I should run after upgrading ANY npm package? This is extremely frustrating!
This screen shot shows today's flavor of the issue:
BTW, I'm on Windows 10, using VS Code. My React Native version is 0.63.1, Node version is 14.7.0 and npm version is 6.14.7
UPDATE:
After a couple of hours of messing around and removing node_modules folder several times and issuing the following commands a few times, it's now started to work. Unfortunately, I can't put my finger on what fixed it. As I said, I did the same things a few times.
Here are the steps I repeated a few times -- though once should be enough:
Deleted the node_modules folder
In root folder, I ran npm cache clean --force
I then reinstalled all npm packages by running npm i
Went into cd android folder and ran ./gradlew clean
Then in project root, I ran npm start -- --reset-cache
Unfortunately, doing this the first time didn't fix the issue. It looks like I have to waste a couple of hours for things to get back to normal! Any idea how to make this problem go away for good?
I think this error is that you have not start the metro bundle. Try react-native start and then re-run the app

What are the components of an Angular/Node/ng application? What does each do and how are they related?

I'm having version issues installing npm/node/angular/ng. What are the different components of an Angular/Node/ng application and how are they related? Are there bundled packages that include everything you need to start developing in a single download? The current project I'm on is managing all of this through npm and is going through the common growing pains of changing versions and changing components and changing dependencies. The npm documentation is good for npm basics but is there documentation that describes best (or common, or recommended) practices for installing everything needed for Angular/node/ng applications (#angular-devkit, #angular-cdk, #schematics/angular, ng, etc.).
The starting point is as follows visiting https://cli.angular.io/ which shows you how to start an Angular app from scratch using Angular CLI.
Now let's say you create a temp folder and do the following as described in above link:
npm install -g #angular/cli
ng new my-dream-app
cd my-dream-app
ng serve
Go to this folder and check the package.json file in the root of that project against yours. That should surely give you the idea of which packages you have.
As the next step run the following command
npm-check -u
and as the final tip: every now and then delete the contents of node_modules (make sure you have everything backed up) and do a
npm install
Then run
ng build --prod
This way around you can always be sure if you clone your app on some other machine, you can install all the dependencies and resume work and also your project builds with no issue.

How to manage npm install in a system without internet connection

I am facing challenges while creating package for all the clientside components of my project in a system which does not have internet connection (for windows).
I have installed NPM for windows in the system. I need to manage the node_modules and run gulp commands in the system to create the package.
Since there is no internet connection in the box, I decided to copy the node_modules from my local box to the box which does not have internet connection.
For copy task, I am using msbuild script but somehow it is not working for me. Also, I see that when I am trying to copy the node_modules manual from one folder to another folder I am unable to copy.
Installed Node version : v0.12.2
NPM version: 2.7.4
Can anyone help me to provide any working sample to fix the above problem.
I think your approach is generally sound. You can build on the internet connected computer no problem! Copy files over with a usb stick if you like.
Here are some tips that might help solve your problems.
If the box is offline, develop on your local machine and deploy to the box
If possible do the gulp steps also on your local machine
Otherwise you need to run the local directory install of gulp. e.g.
node node_modules\gulp\bin\gulp.js build
because you won't be able to npm install -g gulp
Point 3 will work for other global npm_modules too btw
If you are facing long paths (> 256 characters) which can cause copy problems
Try using npm dedupe to remove duplicates
Or try copying to a shorter path e.g to c:\proj instead of to c:\very\long\path\proj
Or explicity install a dependency which has a long path
e.g
npm install deepdep#1.2.4
and then prune that folder from the original
rm node_modules\package\node_modules\package_with_too_many_nested_folders
Or Install the latest npm (v3.0 or higher) which solves this issue once and for all
e.g. npm install -g npm
which will build a much flatter hierarchy for your packages. Requires removing and reinstalling all packages.
Point 5 is a notorious issue on windows which is not a problem on linux because paths can be extremely long. (unless you are mounting a windows a windows directory from linux)
Personally I would go straight for the latest npm version but you have a number of ways of getting around the issue if this is not possible.

Resources