How do I "install the modules with `npm install` and run `node index." - npm-install

I stumbled upon a very desirable tool with some quite esoteric instructions.
This is what I would like to make use of:
https://github.com/MehediH/Bulksplash?ref=producthunt
BulkSplash Folder Contents
I apologise but I must ask for an absolute beginner's explanation - I've been searching for quite some time on how to begin to use a tool like this but the explanations are far too technical.
The only instructions in the readme are "install the modules with npm install and run node index."
Where do I even begin?
Thank you very much for reading!

First you must make sure that you have Node.js installed because you need it to run JavaScript outside of browser.
NPM is a Node Package Manager, as it's name says it helps you to manage packages built for that platform, allowing you to easy download, use and keep up-to-date those packages.
Guide on how everything works is already written on npm official site,
if you follow this link you will find that guide, on first glance it is quite long, but considering your needs you can skip a lot of points.
Just make sure to read everything from 1-10th point of Getting started, there is everything you need to be able to use node.js for your needs.

Thanks for the nudge in the right direction - I'm happily using Bulksplash less than an hour later!
Install this: https://nodejs.org/en/download/
Windows + R, enter CMD and run to open the command line
entering node -v into the command line products output "v8.9.4"
entering npm -v produces "5.6.0" (All is going well.)
put the Bulksplash folder in your user folder C:/Users/Yournamehere, rename bulksplash folder Bulk
enter cd Bulk into command line
enter install npm package
check to see if node_modules folder was added to Bulk folder
receive an error when entering node index into the command line
Error: Cannot find module Request
enter npm install progress
enter node index
Error: Cannot find module Commander
npm install Commander
enter node index
Error: Cannot find module Progress
npm install Progress
node index
Welcome to Bulksplash!
Damn it feels good working this stuff out :)
Entering node index --amount 100 downloads 100 random free images!
Awesome!

Related

npm install -g eas-cli fails

I am a newbie to react-native and would like to start developing a react-native app.
I could have started developing by react-native-cli, but I heard there was something called Expo and a way to open an initial app with expo-cli.
I copied and pasted this code npm install -g eas-cli, but it gave me a huge long error message I put its screenshot below.
I have no idea about the system?? inside my computer.
I would be so grateful if anyone gives me a possible solution.
Thanks for your valuable time^^
=========== Edit ===========
So I read the first comment, and run this command on my Mac brew install nvm. It worked nicely and looked for more information for what to do from this point. Then I ran this command mkdir ~/.nvm, and I am stack now. I created a directory called .nvm, but so what from now??
Thanks a lot for taking your time to help me!!
You probably installed npm using sudo, or something like that.
I would recommend to install npm using nvm. It usually removes all those errors.

Error: option 'name' clashes with existing property 'name' on Command

Some context: I've recently been trying to update a react native project that uses expo, since I have not worked on the project for about four months. I believe I finally was able to successfully upgrade the project as expo is starting. The issue is that I am now having some trouble with some of the newer modules I just installed with npm. This error seems to be coming from me not knowing how to use the commander module. Additionally, I do not believe that I have a thorough understanding of modulues in react native/expo. I am using ubuntu 20.04 via windows terminal.
Error:
I did go to the website mentioned in the error. I believe that this link - https://github.com/tj/commander.js#avoiding-option-name-clashes - is what will solve my problem. However, I am confused as to where I should put the example file and how to use it.
I am not very well versed in modules for react native/expo and it is quite possible that I do not need to use this module (I thought that installing it would make my react native program run, but that does not seem to be the case).
Thus, I am looking for advice on either how to use this module, or on whether or not I should be using these modules (after updating node and then expo, the following modules could not be found every time I ran npm start, so I decided to install them using sudo npm install module_name -g since some other stackoverflow/github pages recommended that):
fs-extra
terminal-link
chalk
getenv
commander
#expo/xdl
Any help would be appreciated, and I would be happy to provide any more information that would be relevant.
I was not able to figure out a way to make the project work with the above modules. So, I followed the advice of a post I made on the expo forums (I posted similar context there and also the answer that I wrote below).
If you do not want to click the link, here are the steps below:
Basically, I uninstalled expo using the following command: npm -g uninstall expo-cli --save && yarn global remove expo-cli. Then I proceeded to remove the .expo folder from my home directory. More details on these two steps can be found here.
After that, I reinstalled expo using npm install --global expo-cli, from the expo documentation, in the install section.
Then I closed my terminal, reopened it, and ran expo whoami. The command returned recommending an update, so I followed the provided update command (which I believe was just npm install --global expo-cli again).
I closed the terminal, reopened it, and ran expo whoami again. This time I was just met with "you are not logged into expo" (or something along those lines). So, everything seemed up to date.
I then went to project and ran npm start and it worked fine.
Note: You may need to use sudo for any uninstall and install commands above (your terminal will likely tell you if you do).
Note Clearing cache for npm and yarn may take some time. Additionally, the first time you run npm start may also take some time. I'd say all in all this took about two to three hours, but my computer is also not the best.

Where does npm store module when loading directly from github?

I have found a react-native module I would like to use. It contains an error which prohibits the installation.
I have forked the repository and corrected the mistake.
Now I want to install my module in order to use it, however during execution of the post installation scripts I get an error - file not found.
I have tried to find the reason for it, but the reason is quite simple, the module is not in the node_modules directory, and when npm tries to "enter" there to run the scripts, it can't find them.
I have tried to check where this is installed, but I can't.
I use npm install <user>/<repo> to install my module.

bower install command issuing EHTTP error

I am struggling with installing bower on my system - although there are a few bower install issue scenarios on here, none are a very good match.
In my scenario, I have an externally acquired folder full of source code for a complex software package - the .bowerrc file is located here, as well as a bower.json. As is the default, my .npmrc file is located C:\Users\USER.
I have appended code strict-ssl=false and registry=http://registry.npmjs.org/ into .npmjs, and left the npm cache and config specs in the user directory. I've also left my PATH user variable as C:\Users\USER\AppData\Roaming\npm.
I have so far run three commands successfully:
npm install -g ember-cli
npm install -g bower
npm install
The created files from these commands seem to get dumped into C:\Users\USER\AppData\Roaming\npm\node_modules, and then the final command below is only giving me an EHTTP error.
bower install
I can only think that this issue is only occurring because of the location of the various dependencies. I've been playing around a bit - the last thing I tried was changing the Path user variable so that it instead points to the folder directory with .bowerrc, but the npm installation then has trouble referencing .npmrc. I'd appreciate any ideas, because I might only be chasing my own tail here.
UPDATE
I think I was wasting my time messing about with directory locations. The problem seems to be that there is a legacy proxy inside the .bowerrc file.. now I just need to work out how to get rid of the proxy setting!

Running npm command within Visual Studio Code

Is there anyway of executing the npm command within Visual Studio Code (using f1 into >) on Windows(10) to install packages to my folder I'm working in?
I have npm installed and I keep having to install npm packages from cmd
Install
Ctrl+P, write ext install npm script runner
Restart VS Code
Use (two ways)
Ctrl+R Shift+R
Ctrl+P, write >npm, select run script, select the desired task
Update: Since version 1.3 Visual Studio Code has integrated terminal. To open it, use any of these methods:
Use the Ctrl+` keyboard shortcut.
Use the View | Toggle Integrated Terminal menu command.
From the Command Palette (Ctrl+Shift+P), use the View:Toggle Integrated Terminal command.
You can run npm commands directly in terminal (ctrl + `). Make sure that terminal has cmd.exe as the shell selected.
You can default cmd.exe as your shell by following these steps.
ctrl+Shift+p
Type > Select Default Shell + Enter
Select > Command Prompt ...cmd.exe
Restart VS Code.
There might be a chance that you have install node.js while your visual studio code was open.
Once node.js is install successfully, Simply close the VS Code and Start it again. It will work.
Thank you
On Win10 I had to run VSCode as administrator to npm commands work.
All you need to do is to add args to the integrated terminal within 'User Settings' window.
Follow this steps below to do that:
List item
Go to 'User Settings'
Search for setting named - "terminal.integrated.shellArgs.windows"
Edit this setting by copying it to the right side.
Add the following arg value = "/k nodevars.bat", e.g. "terminal.integrated.shellArgs.windows": ["/k nodevars.bat"],
Make sure that the setting named "terminal.integrated.shell.windows" is set to the value - "C:\Windows\system32\cmd.exe". If not then do that.
Open new Terminal.
Good luck
I installed npm after Visual studio code, closed all visual studio instances and opened again and it started working.
One reason might be if you install the node after starting the vs code,as vs code terminal integrated or external takes the path value which was at the time of starting the vs code and gives you error:
'node' is not recognized as an internal or external command,operable
program or batch file.
A simple restart of vs code will solve the issue.
Edit user setting file settings.json.
Settings > Search for settings.json > Edit in settings.json
or
Run > type %APPDATA%\Code\User\settings.json
Copy this code
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/k nodevars.bat"]
}
Restart VS Code
To install npm on VS Code:
Click Ctrl+P
Write ext install npm script runner
On the results list look for npm 'npm commands for VS Code'. This npm manages commands. Click Install, then Reload VS Code to save changes
Restart VS Code
On the Integrated Terminal, Run 'npm install'
Same thing was happening to me after I installed Node.js. Node and npm was recognized in PowerShell and Command Prompt but not in VS Code. I fixed it by adding the Node.js install path to the system's environment PATH variable. The node.js install path on my system was:
C:\Program Files\nodejs
Where I find the node.exe that is needed. The user's PATH variable already had the Node.js install path but for some reason VS Code needs the Node.js install path in the system's PATH variables.
Windows 10 instructions:
Windows key and type "environment"
Select "Edit the system environment variables"
Click button labelled "Environment Variables..."
In "System variables" section edit the "Path" variable
Add Node.js install path to the list (C:\Program Files\nodejs)
The other answers were great but this is another way to fix it that worked for me without needing to install stuff, run as admin, or change the default settings.
VSCode User Setup is a new installer which installs VSCode and its dependencies in directories which don't require system-level / administrator permissions to modify. This is because New VSCode runs with user privileges. Your Nodejs installation added npm's path as System variable which VSCode cannot read.
Adding NPM path to Path variable in the User variable, you will be able to run NPM from the integrated command line.
Make sure you exit out of the existing terminal window. It will try to recover it and even though you may have closed out of VS Code you want to close the terminal window as well
Try to install PowerShell extension provided by VS code.
After install click on PowerShell and It will start new PowerShell Console where you can run all script
One from this two can help:
A) After you installed NodeJS, and restarted VScode, but still not getting npm to work, then idelete the opened terminal in VSCode with 'recycle' icon and try to create a new instance of terminal. From that moment and onwards, NPM should be working
B) If that doesn't help, then open up the prompt (Ctrl+P) and type >Terminal>Create terminal (with profile) and create 'cmd/powershell' based terminal. Afterwards, npm should be working.
Well, anyone still ends up here, and couldn't resolve the problem, Here is how to fix it.
Check the default terminal in VS Code (ctrl+ ~). It should be cmd and not Powershell.
If it is Powershell, go to settings > features > Terminal › Integrated ›
Default Profile: Windows. And select Command Prompt.
Or in search settings type 'default profile', and select Command Prompt.
Install VS Code extension - npm script runner (npm support for VS Code by Microsoft).
Click on extensions marketplace (ctrl + shift + x).
Type> npm script runner > install
After these steps, npm should be working from VS Code terminal.
There is an extension available, npm Script runner. I have not tried it myself, though.
As an alternative to some of the answers suggested above, if you have powershell installed, you can invoke that directly as your terminal. That is edit the corresponding setting.json value as follows:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
I find this works well as the environment is correctly configured.
Open standard terminal ctrl+p and paste this command
npm i script-runner
Need to see this logs npm should be run outside of the node repl,
in your normal shell. (Press Control-D to exit.)
(To exit, press ^C again or type .exit)
C:\DW\Examples\Ang.Crud>npm i script-runner npm WARN saveError ENOENT:
no such file or directory, open 'C:\DW\Examples\Ang.Crud\package.json'
npm notice created a lockfile as package-lock.json. You should commit
this file. npm WARN enoent ENOENT: no such file or directory, open
'C:\DW\Examples\Ang.Crud\package.json' npm WARN Ang.Crud No
description npm WARN Ang.Crud No repository field. npm WARN Ang.Crud
No README data npm WARN Ang.Crud No license field.
script-runner#0.1.8 added 7 packages from 5 contributors and audited 7 packages in 2.955s found 0 vulnerabilities
Usage: npm
where is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, profile, prune, publish, rb, rebuild, repo, restart,
root, run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm -h quick help on npm -l display
full usage info npm help search for help on npm help
npm involved overview
Specify configs in the ini-formatted file:
C:\Users\fdc.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config
npm#6.4.1 C:\Program Files\nodejs\node_modules\npm
For me, this problem is fixed after installing the extension ES7 React/Redux/GraphQL/React-Native snippets. I am using windows 10 and the latest version of VS Code, and a little interpreter icon occurred on the lower right of the status bar.
Try this.
npm not works in Visual studio code
open vs code then Ctrl+P -> type - ext install npm script runner
you have to choose one and install it. once installed please close and open Visual studio code
and go to vs code terminal and type npm start and browser will start http://localhost:3000
Its working good. Thanks
I restarted my machine, after checking the path in environment variable. it worked for me.
In terminal run ->
npm install script-runner
You probably dont have your path variable set for npm on your machine. And typescript has nothing to do with this issue. VS Code is built on TypeScript for type checking when you're using JavaScript. But i'd suggest you to uninstall Node from your machine and re-install Node from here. Make sure you install the latest version of Node. Node comes with npm and it also sets the PATH_VARIABLE for terminal. In order to check if the path variable set or not , you can try this command node --version or npm --version.
Download Node.js from the link here
Install and then Then restart
You have to do the following 3 steps to fix your issues:
1.Download Node.js from here.
Install it and then add the path C:\Program Files\nodejs to your System variables.
Then restart your visual studio code editor.
Happy code