npm installation in command prompt - javascript

After setting new windows in my laptop,i am trying to install npm in command prompt.But i am facing an error which picture is given in below.Would anybody help me out?

If you don't specify a package to install (like npm install -g nodemon) npm will try to install all packages from the current package.json file. If there is non, npm will throw this error.

Npm is already installed. That is why the error message is not Command not found.
The specific command you issued npm install -g attempts to use npm to install the package in the current directory globally.
Leaving the point that installing packages globally is a bad idea aside, this is failing because you are running the command in a directory that does not contain a package. It is your home directory, not one containing a package.json file.

If you are trying to install npm(node package manager) do it by downloading it from here: https://www.npmjs.com/get-npm, then you are good to go.
The command you are actually giving is to install a package using npm(check https://docs.npmjs.com/cli/install).
Thats why the error shows could not install from "" as you have not specified any package to install.

Related

Any idea why adonis migration command not working?

Adonis command neither give error nor works
I just clone the Node project from one PC to another. Installed npm and adonis. Now my Node project is working when I open the URL at which it is serving it shows me the login page.
When in try to execute the Migration command, cli is neither executing the command nor giving any error.
Try to reinstall #adonisjs/cli :
Uninstall (Globally):
> npm uninstall -g #adonisjs/cli
Install (Globally):
> npm i -g #adonisjs/cli
#adonisjs/cli must be installed globally (it's not a project dependency)
Installation - AdonisJS documentation

Getting error Cannot find module 'cryptile' while installing express js

I am new to node js and facing issue in installing express js. Please help in fixing the issue and install express js.
Now when i tried to install cryptiles module using the command "npm install cryptiles" i am getting the same error.
Just run npm install cryptiles then re-run your previous command
or if you don't want then go to your packages.json file and remove the dependency...
UPDATE :
Seems this package isn't supported anymore ..
To see yourself install globally:
npm install -g cryptiles
then install try to install in source destination
npm install cryptiles
You should get the following message:
npm WARN install Couldn't install optional dependency: Unsupported

Installing NPM packages conflicting with Node.js 5.0.0

I am trying to install npm packages, which i need for my code to work.
However when i try to install any npm package, it gives the same error:
Your environment has been set up for using Node.js 5.0.0 (x64) and npm.
C:\Windows\System32>npm install mime
C:\Windows\System32
└── mime#1.3.4
npm WARN ENOENT ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
npm WARN EPACKAGEJSON C:\Windows\System32 No description
npm WARN EPACKAGEJSON C:\Windows\System32 No repository field.
npm WARN EPACKAGEJSON C:\Windows\System32 No README data
npm WARN EPACKAGEJSON C:\Windows\System32 No license field.
C:\Windows\System32>
I have tried re-installing node.js twice, but this didn't work. I've also tried to run it as administrator and install it again, which didn't work.
My classmate also works with node.js, but whenever he isntalled node.js everything worked fine from begin, also installing npm packages.
I'd really appreciate your guys help!
Sincerely,
Ivar
The error messages you're receiving aren't telling you the installation failed, just that you don't have a package.json in the system32 folder. For global install add -g to the installation:
npm install -g mime --save
--save just means you save it to your package.json if you're in a root project that has a package.json.
There should be a node_modules in system32 provided you have writing access to it. (sometimes you need to enable that even for admins).
Well, actually it installed package. Check node_modules folder.
It complains that you don't have package.json file and README, etc.

Error in npm for npm install selenium-webdriver

I am using Windows Server 2008 R2 EE OS. In which I have npm package manager. I am trying to run the below command to install Selenium Webdriver package.
Command:
npm install selenium-webdriver
I am receiving below error while doing it.
Error:
node.js npm should be run outside of the node repl in your normal
shell
You are running the npm command inside the node shell.
Open another shell and just type "npm install bla-bla", npm should be on the PATH. Or cd to its directory and type command.
See my command images
Doing it wrong
Doing it right
In the case of windows, sometimes it is bad to consider that the npm will create folder itself for what it required.
The best is to manually create npm folder like "C:\Users\username\AppData\Roaming\npm".
Hope this help.
By creating a folder C:/Users//AppData/Roaming/npm solved my problem.

npm install -g is installing to a local folder

I have been using node and npm for a while, and I just started a larger scale project using it. Recently, however, whenever I run sudo npm install -g, it will install it into a ~/Programming/usr/local/bin instead of /usr/local/bin. Does anyone know why this is happening? How can I reset the installation location
You can set the location by running the following command.
npm config set prefix /usr/local

Categories