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.
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.
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.
I am trying to support the how to crack a interview repository
I am trying to crack the interviews for JS position
They are using mocha and chai, so I am trying to commit the code in
JS
I am trying to execute the below steps but I am failing at the below
step, npm install
git clone https://github.com/gaylemcd/ctci.git
cd ctci/javascript
npm install
npm install -g mocha
mocha --recursive
I am getting the below error
I have installed Node.js after that tried npm install in ctci folder of javascript
providing you the link for screensshot to show where node is
installed and where I kept ctci
https://drive.google.com/file/d/0B3IBJKENGE7RMGlUYWZUa2lZY3c/view?usp=sharing
anis-MacBook-Pro:javascript Raj$ npm install
npm WARN package.json CrackingJS#0.0.1 No repository field.
That is a warning, not an error. It is simply pointing out that the package.json does not contain a "repository" field, which is a recommended field to have for convenience. You can safely ignore most warnings, especially ones like this one.
I am trying to install node in my mac..
i am getting the following error...
i downloaded the node from node site and ran that package...
can you guys tell me why i am facing that errror..when i do npm install
MacBook-Pro:~ Raj$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/Users/Raj/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/Raj
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /Users/Raj/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Raj/npm-debug.log
npm ERR! not ok code 0
Running just "npm install" will look for dependencies listed in your package.json. The error you're getting says that you don't have a package.json file set up (or you're in the wrong directory).
If you're trying to install a specific package, you should use 'npm install {package name}'. See here for more info about the command.
Otherwise, you'll need to create a package.json file for your dependencies or go to the right directory and then run 'npm install'.
I had this problem when trying to run 'npm install' in a Terminal window which had been opened before installing Node.js.
Opening a new Terminal window (i.e. bash session) worked. (Presumably this provided the correct environment variables for npm to run correctly.)
In my case it was due to a bad URL (http:// instead of git://, no .git at the end) for one of the dependencies.
You're likely not in the node directory. Try switching to the directory that you unpacked node to and try running the command there.
In case it helps anyone else - my issue was a rookie error, I had a space in the name line of my package.json and it caused the dependencies to be unreadable.
I came across this, and my issue was using an older version of node (3.X), when a newer version was required.
The error message actually suggested this as well:
...
Make sure you have the latest version of node.js and npm installed
...
So the solution may be as simple as upgrading node/npm. You can easily do this using nvm, the "Node Version Manager"
After you've installed nvm, you can install and use the latest version of node by simply running this command:
nvm install node
For example:
$ nvm install node
Downloading https://nodejs.org/dist/v8.2.1/node-v8.2.1-darwin-x64.tar.xz...
######################################################################## 100.0%
Now using node v8.2.1 (npm v5.3.0)
$ node --version
v8.2.1
In mac you might have downloaded and installed Node js in
/Users/yourusername/Downloads/nodejs-todo-master , so go here and run npm install command, no need of sudo as well., you should get output like this...
underscore#1.4.4 node_modules/underscore
ejs#0.8.8 node_modules/ejs
redis#0.8.6 node_modules/redis
jasmine-node#1.0.28 node_modules/jasmine-node
├── walkdir#0.0.7
├── coffee-script#1.8.0 (mkdirp#0.3.5)
├── requirejs#2.1.15
└── jasmine-reporters#1.0.1 (mkdirp#0.3.5)
express#3.0.6 node_modules/express
├── methods#0.0.1
├── fresh#0.1.0
├── range-parser#0.0.4
├── cookie-signature#0.0.1
├── buffer-crc32#0.1.1
├── cookie#0.0.5
├── commander#0.6.1
├── mkdirp#0.3.3
├── debug#2.1.0 (ms#0.6.2)
├── send#0.1.0 (mime#1.2.6)
└── connect#2.7.2 (pause#0.0.1, bytes#0.1.0, formidable#1.0.11, qs#0.5.1)
First download json package file from https://github.com/npm/read-package-json
and then run npm install from terminal.
This is all because you are not in the desired directory. You need to first get into the desired directory. Mine was angular-phonecat directory. So I typed in cd angular-phonecat and then npm install.
If someone is in my situation facing this error and have tried all the above solutions, like:
you are in the right directory
you have a package.json file,
the JSON is valid,
you have tried to run %temp%
you have tried " npm install -d --save"
etc.
Mine worked by doing "npm install --force"
Note: This was also recommended in the error itself, which I didn't pay attention to earlier.
Even " Yarn install" worked.
npm install -d --save worked for me. -d flag command force npm to install your dependencies and --save will save the all updated dependencies in your package.json
For me I'm on windows 10 X64...
My code npm install on cmd failed
So instead of npm i used Yarn
Just type yarn install instead of npm install
This fixed my problem.Tried for 2 days finally found the best
solution
To install yarn , on cmd enter the following code
npm install --global yarn
To check if it has installed correctly enter the following code
yarn --version
Hey if you found error and it stuck while installing then try this
Open run and type %Temp% and delete all file
Then type prefetch on run app an delete all files then try it
These Will do the Job
npm install -g yarn
yarn install
or
npm install --force
Hey if you found error and stcuk while installing packages
,getting only three files like json file ,lock file and module file using yarn then try this using yarn.
Open run and type %Temp% and delete all file
Then type prefetch on run app an delete all files
Then type on CMD npx create -react-app it will give you all packages