module npm file doesn't appear to me - javascript

I am trying to follow with pluralsight tutorial and he wrote npm install on the terminal, then a file called npm module is installed on the folder he specified. when I try to install npm this appears to me in the terminal, and the directory which Im trying to install npm on it contains only one document called package-lock.json enter image description here

npm install uses the package.json to install the necessary packages
I can see when you ls, there's no package.json in the directory, just the package-lock which is created where ever you run npm install
Make sure you run the npm install from the same directory the package.json in contained in

the problem is solved, I think that I download the web-dev-starter folder twice by mistake.

Related

npm ERR! could not detect node name from path or package

today i was trying to install my package in visual studio. But there is an error:
enter image description here
npm i
npm ERR! could not detect node name from path or package
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\holan\AppData\Local\npm-cache_logs\2021-09-01T00_08_12_922Z-debug.log
I reinstall node.js and python
here is my path
enter image description here
sorry for my bad english but i need help
As OP didn't provide details of the issue and seems to be new to nodejs, hereby explaining how npm i work in general matter.
There are main usage of npm i:
To install a package that haven't install in this project(or global) before, you can put that package name after the npm i , such as npm i express. Once the installation is done, it will insert the package name into package.json and the package source code in node_modules. You can think package.json is like a index and node_modules is the actual packages source code.
To install a package that listed in package.json. If you are copying/clone the project from other source , usually it has package.json but not the node_modules. In that case, you can use npm i to install all the packages that listed in package.json and it will then create the node_modules.
Using npm i without package.json will not install anything as there isn't a package name in the npm i [package name] and package.json .

"npm install" not installing any library. How to resolve this issue?

I am using Node version 14.15.5 and npm version 6.14.11. Also, I am working on VS Code.
I have tried to install two packages by these commands:
npm install express
npm install lodash
In the end, I am not getting any of them successfully.
I received this message:
36 packages are looking for funding
run `npm fund` for details.
How to resolve this issue?
enter image description here
The reason is described here:
Before installing a package into the local folder, NPM tries to find the root of your package. To do this it walks from your current directory (C:\Users\JD Mughal\Desktop\Web\Node\test-calculator) up the hierarchy until it finds a package.json file.
Only if no package.json file is found will NPM install the new package in the current directory (respectively in a node_modules\package_name subdirectory).
In your case however NPM finds a package.json file C:\Users\JD Mughal\package.json and installs the new package there.
To resolve the use you must execute npm init in your local directory.

npm start and install are not working

I tried to run npm install and npm start but both does not work. I reinstalled the nodejs but still the same. How to resolve it?
If you're trying to install the dependencies of an existing project (which the context implies), you need to run the command npm install in the directory where the package.json file of the project is.
If you've created a new and empty project folder, you need to first run npm init to create a package.json file which is used to manage the dependencies of your project.
Are you sure you're in the head directory? For example, if your project is in:
$ Documents/Projects/JS-Projects/Work/Client-Management-App/
Then that's the folder you need to be in: the Client-Management-App/ directory, because that's where the package.json file and the /node_modules/ folder will be created.
Also, have you run npm init? That might be another reason why.

Installed package through npm but it does not show in folder

I was trying to install jquery through npm but after using following command:
npm install jquery
I opened the destination folder and the folder was empty.
(I copied the following text from cmd)
> C:\Users\mandar\Desktop\Mady>npm install jquery
C:\Users\mandar
`-- jquery#3.1.1
> npm WARN enoent ENOENT: no such file or directory, open
> 'C:\Users\mandar\package.json'
npm WARN mandar No description
npm WARN mandar No repository field.
npm WARN mandar No README data
npm WARN mandar No license field.
What am I doing wrong? Please help me
You don't have a package.json. Create a one and then try to install jQuery. And instead use
npm install jquery --save
command to save the jquery dependency in the package.json file
You can do it manually creating package.json or by
npm init and passing the steps
create package.json file manually or through cmd by command npm init or npm install jquery --save
As Suren Srapyan mentioned, in order to solve the problem, you need to create a package.json file, which describes the project you're working on.
The easiest way to create a package.json file is to run npm init - this will invoke a terminal-based walkthrough of creating the package.json file.

How to install a local package from a local source?

I use this git repo: https://github.com/kudago/smart-app-banner
I downloaded it with git clone https://github.com/kudago/smart-app-banner.
Then I tried to install it from its parent dir with:
npm install --save smart-app-banner
This always installs the source from the github repo instead of from the local source.
How do I get the source being install from the local copy instead of from github?
npm install /path
it is as simple as that
If you run npm install without any arguments, it tries to install the current folder.
Go to that folder and type npm Install
or
Just put that downloaded File in Node_modules folder of your project.

Categories

Resources