[javascript] npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'

I just want to install socket.io to my project which is located on 3.chat folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my project folder. How to fix this?

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm install socket.io
C:\Users\Nuwanst
`-- [email protected]

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'
npm WARN Nuwanst No description
npm WARN Nuwanst No repository field.
npm WARN Nuwanst No README data
npm WARN Nuwanst No license field.

This question is related to javascript node.js npm server node-modules

The answer is


Delete package-lock.json it works for me

then npm install


finally, I got a solution if you are getting:-

**npm WARN tar ENOENT: no such file or directory,.......**

then it is no issue of npm or its version it is os permission issue to resolve this you need to use below command:-

sudo chown -R $USER:$USER *

additional

sudo chmod -R 777 *

then run:-

sudo npm i 

we need to create package.json by entering npm init and enter package name as package.json and optionally fill other requirements else press enter and at last enter yes to confirm. Great!! Now install any npm package without any error.

npm install <package_name>

Windows10


NOTE: if you are experiencing this issue in your CI pipeline, it is usually because npm runs npm ci instead of npm install. npm ci requires an accurate package-lock.json.

To fix this, whenever you are modifying packages in package.json (e.g. moving packages from devDependencies to Dependencies like I was doing) you should regenerate package-lock.json in your repository by running these commands locally, and then push the changes upstream:

rm -rf node_modules
npm install
git commit package-lock.json
git push

If you're trying to npm install on a folder that's being rsync'd from somewhere else, remember to add this to your rsync --exclude

yourpath/node_modules

Otherwise, NPM will try to add node_modules and rsync will remove it immediately, causing many npm WARN enoent ENOENT: no such file or directory, open errors.


If your folder already have package.json

Then,

Copy the path of package.json

Open terminal

Write:

cd your_path_to_package.json

Press ENTER

Then Write:

npm install

This worked for me


You can use npm init to create a package.json.


update version in package.json is working for me


if your node_modules got installed in say /home/UserName/ like in my case, your package-lock.json file will also be there. just delete this file, go back to your app folder and run npm init and then npm install <pkgname> (e.g express) and a new node_modules folder will be created for your.


If you already have package-lock.json file just delete it and try again.


I had this in a new project on Windows. npm install had created a node_modules folder for me, but it had somehow created the folder without giving me full control over it. I gave myself full control over node_modules and node_modules\.staging and it worked after that.


Make sure you are on the right directory where you have package.json


the file path you ran is wrong. So if you are working on windows, go to the correct file location with cd and rerun from there.


Seems you have installed express in root directory.Copy path of package.json and delete package json file and node_modules folder.


You need to make sure if package.json file exist in app folder. i run into same problem differently but solution would be same

Run this command where "package.json" file exist. even i experience similar problem then i change the folder and got resolve it. for more explanation i run c:\selfPractice> npm start whereas my package.json resides in c:\selfPractice\frontend> then i change the folder and run c:\selfPractice\frontend> npm start and it got run


Run command - npm init No file directory found issue got resolved


This worked for me:

I simply cd "C:\the_path_of_the_project_where_package.json_is"

before I ran "npm start"


Delete package.json and package-lock.json file

Then type npm init

after that type npm install socket.io --save

finally type npm install

It works for me


Examples related to javascript

need to add a class to an element How to make a variable accessible outside a function? Hide Signs that Meteor.js was Used How to create a showdown.js markdown extension Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Summing radio input values How to execute an action before close metro app WinJS javascript, for loop defines a dynamic variable name Getting all files in directory with ajax

Examples related to node.js

Hide Signs that Meteor.js was Used Querying date field in MongoDB with Mongoose SyntaxError: Cannot use import statement outside a module Server Discovery And Monitoring engine is deprecated How to fix ReferenceError: primordials is not defined in node UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac internal/modules/cjs/loader.js:582 throw err DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean`

Examples related to npm

What does 'x packages are looking for funding' mean when running `npm install`? error: This is probably not a problem with npm. There is likely additional logging output above Module not found: Error: Can't resolve 'core-js/es6' Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist` ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean` What exactly is the 'react-scripts start' command? On npm install: Unhandled rejection Error: EACCES: permission denied Difference between npx and npm?

Examples related to server

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json' Golang read request body currently unable to handle this request HTTP ERROR 500 How do I solve the "server DNS address could not be found" error on Windows 10? Server http:/localhost:8080 requires a user name and a password. The server says: XDB What does "app.run(host='0.0.0.0') " mean in Flask How to configure port for a Spring Boot application Apache2: 'AH01630: client denied by server configuration' Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port) Express.js - app.listen vs server.listen

Examples related to node-modules

SyntaxError: Cannot use import statement outside a module What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that? Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51 npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json' Cannot find the '@angular/common/http' module How to use paths in tsconfig.json? Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type How to fix 'fs: re-evaluating native module sources is not supported' - graceful-fs How to provide a mysql database connection in single file in nodejs Git - Ignore node_modules folder everywhere