Node cmd files going to root instead of .bin folder? - javascript

I've been trying to start a project with the vue cli template, but when I npm install I get a bunch of cmd files in the root!
I have checked my environment variables too and they seem correct. Does anyone know why this is happening?
I'm using node v8.11.4 on Windows 10, using VS Code as my IDE. I've also noticed my node_modules folder doesn't have a .bin folder in it.
I have tried reinstalling it multiple times, as well as creating create-react-app where the npm install does the same thing.
Any help would be appreciated, thanks!

Related

i can't execute bootstrap files on localhost xampp

i have downloaded this project from github: https://github.com/DrA1ex/fourier
I am using XAMPP, localhost.
i am new to github, so i wish for detailed help on this one.
i have cloned the project into my htdocs folder, when i try to connect to it won't work.
When i click on the index.html file located in the src folder, it leads to a blank page.
The project is using bootstrap and i don't know how to make it work.
Is there any more info needed, to solve this, please let me know.
Best regards
There is no need to use XAMPP for this project since it is using javascript and Node to run everything.
What you need to do is have node installed on your computer. Go to Nodejs.org and download the recommended LTS version. This will also install npm (Node Package Manager)
After the installation, go to your project folder, where the file package.json is located, open a terminal (CMD - Command Line) and run:
npm install
This will download all the dependencies that are needed for this project to work.
When it is done, you just need to open a terminal again on the same directory and run:
npm start
Your project will run on localhost (a link will probably appear on your terminal). For me, the project run on http://localhost:4200/ but for you it might be different.
Hope this helps

Node cannot find path in node_modules / 'react-scripts' is not recognized as an internal or external command

I'm on windows 10
When I run:
npm run start
or
npm start
I get an error:
npm start
> app-test#0.1.0 start
> react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
What I already tried:
npm ci
remove node_modules and reinstall project
npm audit fix
run command from elevated PowerShell (as admin)
Uninstall Node v.18 win NVM and reinstall common Node installation LTS v.16
Check if react scripts is on dependencies section in package.json - and it's of course there.
Recreate project itself and also create a fresh new React project with npx create-react-app
Clearing npm cache
Nothing's helped me.
BUT This project runs fine WHEN I explicitly tell the node path to subfolder with a script:
app-test> node node_modules/react-scripts/scripts/start.js
Compiled successfully!
You can now view app-test in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.91.1:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
What's interesting that an old React projects also resided in the parent folder starts normally even I renew node_modules in these projects doing them npm i or npm ci
But any time I try to create and start new React app command npm start fails
UPD1: Tried to create-react-app on any other drive or folder. And it's running ok.
So culprit seems permissions policies in my common working directory ?
UPD2:
I resolved a problem though still have no clear idea who was actually the really culprit of this bug.
I copied all my parent developer folder with all code examples to another drive, then tried to create react app there and out of the blue it worked fine at then new location.
Also I removed this original folder from the drive where it used to be. And do git clone "..." at this directory< recreating the exact structure as it was before all experiments.
Then I tried create-react-app exactly at that location as I've unsuccessfully tried before swapping folders and it was OK !
Tried couple of time with different folder location within parent directory and all sill working fine now !
I remembered now I already have such bug before. And I had to reinstall Windows that time.
I also want to mention that I also have another machine with Windows, another one with Linux and had also laptop with an OSX so I can ( or could) push to this very git repository from any of these computers.
Suggestion of somebody who have any idea, why this bug was happening repeatable would be highly appreciated.
Thanks.

Javascript issue installing npm packages (nodemon, express)

I'm new to js and trying to setup a simple project with express and nodemon via npm.
However, installing these packages does give me multiple errors (see below).
I am on Win 10, using the PowerShell & Atom IDE. Project is saved on Google Drive.
"Calc.js" is simply the name of my project.
I have node & npm installed and restarted pc multiple times before.
Then I set up the npm init
I begin to install the first package and get this error:
I try to install express, but get the same result, adding -g also does not make a difference. Now I install "ci", which works for some reason.
Now I have the node modules folder in my project, try to install express again, and it seems to kinda work (got the files in the node_modules folder).
However when I try to run the calc.js via "node calc.js" it
does not work.
Already tried out many things and even accidentally made it work, then tried to reproduce it and failed. Would be super happy for some help.

Deploying a NestJs project on a single board computer (Raspberry or similar)

even if it seems a simple task I'm having some trouble finding a solution. I know that with Nest CLI I can use the command "nest build" in order to create a dist folder that contains the production files of my project.
The problem is when I move the folder on my Raspberry and i try to run the project with the command "node dist/main" following NestJs instructions. Nothing starts because node says that it cannot find #nestjs/core and other modules.
I did't find nothing clear in the official guide about deploying the app, so my question is: what do I need to move onto my rasperry in addition to dist folder? Do I need to reinstall all node_modules folder or it's possible to have a running project without have to reinstall 800Mb of modules?
Yes you need to run yarn or npm install on your production environment, as your dist folder only contains your own code.
Because unlike compiled language like Golang where all dependencies are bundled and compiled in you executable file, Javascript bundlers don't. Your bundled code in dist still contains require or import statement to get dependencies from node_modules.
You can also run npm prune --production to remove any developpement dependencies and thus reduce the size of your node_modules folder. (I believe that yarn does it by default.)

NPM is creating ton of cmd and ps1 files

I am using Windows 10 laptop, recently, I started getting the .cmd and .ps1 files getting created in the root Node js application.
It looks like the contents of node_modules/.bin/ folder are entirely pushed to root folder.
I have tried to uninstall and install the Node but no luck. I tried to install the latest Node and also Node 12.x.x but I am still getting the same issue.
I tried to create a fresh Node js application too. Any ideas, please?

Categories

Resources