I’m trying to install the dependencies of some example: npm’s express 2.5.8
that I’ve downloaded, but all of the apps throw the same error:
c:\node\stylus>npm install -d
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm ERR! Couldn't read dependencies.
npm ERR! Error: ENOENT, no such file or directory 'c:\node\stylus\package.json'
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d"
npm ERR! cwd c:\node\stylus
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.1
npm ERR! path c:\node\stylus\package.json
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'c:\node\stylus\package.json'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\node\stylus\npm-debug.log
npm not ok
The blockage appears to be:
no such file or directory ‘c:\node\stylus\package.json
Did I miss a step that creates the package.json
?
I’m running:
- Windows 7 64 bit
- npm 1.1.1
- node 6.11
- express 2.5.8
asked Feb 28, 2012 at 15:33
9
I think, npm init
will create your missing package.json
file. It works for me for the same case.
lealceldeiro
14.5k6 gold badges50 silver badges81 bronze badges
answered Jun 7, 2016 at 19:22
Deepali AgarwalDeepali Agarwal
2,1192 gold badges9 silver badges3 bronze badges
0
In your project’s folder, you need to initialize the package.json
file by running the following in the terminal:
npm init
After that, you should be able to install any packages as you would expect, like express:
npm install express
Shout out to Deepali’s answer.
answered Apr 5, 2012 at 17:36
AldoAldo
1,6771 gold badge12 silver badges15 bronze badges
3
I’ll be brief but deadly. install -d will not work for you. It’s simple. Try
$ npm install -g express
answered Oct 23, 2012 at 21:38
Zoe MarmaraZoe Marmara
1,1421 gold badge10 silver badges15 bronze badges
2
Follwing the below steps you well get package.json file.
npm --version
npm install express
npm init -y
Bhargav Rao
50.4k28 gold badges122 silver badges140 bronze badges
answered Feb 2, 2017 at 7:23
ElangovanElangovan
3,4694 gold badges31 silver badges38 bronze badges
If Googling «no such file or directory package.json» sent you here, then you might be using a very old version of Node.js
The following page has good instructions of how to easily install the latest stable on many Operating systems and distros:
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
answered Aug 20, 2012 at 9:47
GerryGerry
10.6k4 gold badges41 silver badges50 bronze badges
3
Beginners usually try the npm command from random locations.
After downloading or creating a project, you have to cd into this project folder. Inside is the file package.json.
cd <path_to_project>
npm install
Matt Montag
7,1258 gold badges41 silver badges47 bronze badges
answered Apr 18, 2018 at 10:24
Victor1125Victor1125
6525 silver badges16 bronze badges
0
Use the command in win7/win8/win10 (CD) for moving folders:
-
Enter your projects folder
-
Run:
npm install -d
Laurel
5,99514 gold badges31 silver badges58 bronze badges
answered May 31, 2016 at 18:46
try re-install Node.js
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
and update npm
curl -L https://npmjs.com/install.sh | sudo sh
answered Dec 31, 2015 at 11:04
Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you’ll want to make sure it’s the latest version.
sudo npm install npm -g
Test:
npm -v //The version should be higher than 2.1.8
After this you should be able to run:
npm install
bruntime
3712 silver badges13 bronze badges
answered Sep 19, 2015 at 14:16
I found myself here trying to resolve the same error message:
npm ERR! message ENOENT, no such file or directory 'c:\<some_folder>\package.json'
The error could be due to two reasons:
- You do not have the package.json
- You have the
package.json
, but you are runningnpm start
in the wrong folder
To troubleshoot the first cause, you need to create a package.json using:
npm init
To fix the second cause, make sure the folder you are running the npm start
command is the same folder as the package.json
answered Dec 15, 2020 at 21:52
EarlyCoderEarlyCoder
1,2332 gold badges18 silver badges43 bronze badges
It may be very evident,
but try to launch CMD
(for Windows) from the project folder,
where your package.json file is located.
Do not launch CMD
from System or from «Search bar» in Win or
move to your project folder with help of cd
command and then launch npm start
.
answered Feb 1, 2017 at 12:44
rock_walkerrock_walker
4535 silver badges14 bronze badges
I had a similar problem with npm. The problem was that I had the project inside two folders of the same name. I resolved it by renaming one of the folders to something else (outer folder recommended).
g00glen00b
42.3k13 gold badges96 silver badges134 bronze badges
answered Jan 4, 2018 at 10:32
It by itself says that package.json
is not available in your project.
So, to create package.json
, use the following steps:
- open command prompt on your project directory
npm init
(it will ask you to enter lots of entries like name, version, desc, etc., enter some random values and click enter).- type
yes
and click enter
Now try again.
Marko Bonaci
5,6222 gold badges35 silver badges55 bronze badges
answered Jan 13, 2018 at 14:16
0
Go inside the project folder and check whether the package.json file does exist.
If you are creating the project using Visual Studio Angular project, make sure you run this command inside the ClientApp Folder. there is a good chance, you could be looking for project.json file outside the ClientApp folder.
answered Oct 15, 2018 at 3:28
1
if the package.json file in the project directory is missing then you can create it by
npm init.
if the package.json file is already created in the project directory then there is a possibility that you are not running your project from the right path.
Use cd your-project-path
in the terminal and then run your project from there.
answered Jul 6, 2019 at 12:34
npm init -y
use this command, it will automatically create package.json file with all your machine information.
answered May 1, 2020 at 8:22
I was experiencing this identical error and terminal (foolishly, on my part) was in a parent directory instead of the correct one (where package.json
was correctly located).
All I did in terminal was cd [insert correct directory name here, overwriting brackets]
and that corrected the problem.
answered Aug 6, 2021 at 18:55
Mark GavaganMark Gavagan
8781 gold badge12 silver badges45 bronze badges
1
Thank you!
I also tried many options for this. I am also using windows.This command helped and saved my time:
npm install -g npm@lts
answered Nov 4, 2016 at 13:56
bhattraidebbhattraideb
4077 silver badges25 bronze badges
ok, try to go to the home «user@user:~$ » (cd + enter key), and npm install -g your your_module.
answered May 22, 2017 at 22:35
just install any package you want with -g
npm install -g express
Nisarg
1,6316 gold badges19 silver badges31 bronze badges
answered Nov 7, 2018 at 15:36
prosper1prosper1
3042 silver badges9 bronze badges
0
For the following command
sudo npm install react browserify watchify babelify --save-dev
I got same error
saveError ENOENT: no such file or directory, open
‘/Users/Path/package.json’
But when I run the command
sudo npm install -gd react browserify watchify babelify --save-dev
then no missing file or directory message appeared.
answered Feb 10, 2016 at 12:44
zeeawanzeeawan
6,6872 gold badges50 silver badges56 bronze badges
I have run npm install -y
to skip the question step for creating the missing file package.json
, y
means yes
answered Mar 29, 2017 at 2:19
I was also facing same issue while installing typescript. I just initialized an package.josn file by the following command
npm init -y
And then i installed my typescript
npm install -g -typescript
http://blossomprogramming.blogspot.com/
answered Aug 16, 2017 at 10:33
Please check the directory or the folder in which you’re installing your new package.
This happened to me as well,
My whole project was in a subdirectory and I was trying to install in the main directory. After checking the whole thing I found out that I had to install in the subdirectory where my project files and package.json files are located and it’s done.
Hope this helps…
answered Feb 13, 2020 at 12:33
the previous tips do not pay attention to any change for me. at the end this works for me:
- delete the local repo folder
- git clone https … myRebo.git
- npm install
- npm start
hope it helps somebody
answered Sep 18, 2021 at 5:52
SL5netSL5net
2,3234 gold badges28 silver badges44 bronze badges
Adding -g before the package name worked for me. Looking for documentation to explain why this works..
answered Jun 4, 2017 at 19:02
Generate package.json without having it ask any questions. I ran the below comment in Mac and Windows under the directory that I would like to create package.json and it works
$ npm init -y
Wrote to C:\workspace\package.json:
{
"name": "workspace",
"version": "1.0.0",
"description": "",
"main": "builder.js",
"dependencies": {
"jasmine-spec-reporter": "^4.2.1",
"selenium-webdriver": "^4.0.0-alpha.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
answered Dec 28, 2019 at 18:49
ecamurecamur
991 silver badge4 bronze badges
I’m trying to install the dependencies of some example: npm’s express 2.5.8
that I’ve downloaded, but all of the apps throw the same error:
c:\node\stylus>npm install -d
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm ERR! Couldn't read dependencies.
npm ERR! Error: ENOENT, no such file or directory 'c:\node\stylus\package.json'
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d"
npm ERR! cwd c:\node\stylus
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.1
npm ERR! path c:\node\stylus\package.json
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'c:\node\stylus\package.json'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\node\stylus\npm-debug.log
npm not ok
The blockage appears to be:
no such file or directory ‘c:\node\stylus\package.json
Did I miss a step that creates the package.json
?
I’m running:
- Windows 7 64 bit
- npm 1.1.1
- node 6.11
- express 2.5.8
asked Feb 28, 2012 at 15:33
9
I think, npm init
will create your missing package.json
file. It works for me for the same case.
lealceldeiro
14.5k6 gold badges50 silver badges81 bronze badges
answered Jun 7, 2016 at 19:22
Deepali AgarwalDeepali Agarwal
2,1192 gold badges9 silver badges3 bronze badges
0
In your project’s folder, you need to initialize the package.json
file by running the following in the terminal:
npm init
After that, you should be able to install any packages as you would expect, like express:
npm install express
Shout out to Deepali’s answer.
answered Apr 5, 2012 at 17:36
AldoAldo
1,6771 gold badge12 silver badges15 bronze badges
3
I’ll be brief but deadly. install -d will not work for you. It’s simple. Try
$ npm install -g express
answered Oct 23, 2012 at 21:38
Zoe MarmaraZoe Marmara
1,1421 gold badge10 silver badges15 bronze badges
2
Follwing the below steps you well get package.json file.
npm --version
npm install express
npm init -y
Bhargav Rao
50.4k28 gold badges122 silver badges140 bronze badges
answered Feb 2, 2017 at 7:23
ElangovanElangovan
3,4694 gold badges31 silver badges38 bronze badges
If Googling «no such file or directory package.json» sent you here, then you might be using a very old version of Node.js
The following page has good instructions of how to easily install the latest stable on many Operating systems and distros:
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
answered Aug 20, 2012 at 9:47
GerryGerry
10.6k4 gold badges41 silver badges50 bronze badges
3
Beginners usually try the npm command from random locations.
After downloading or creating a project, you have to cd into this project folder. Inside is the file package.json.
cd <path_to_project>
npm install
Matt Montag
7,1258 gold badges41 silver badges47 bronze badges
answered Apr 18, 2018 at 10:24
Victor1125Victor1125
6525 silver badges16 bronze badges
0
Use the command in win7/win8/win10 (CD) for moving folders:
-
Enter your projects folder
-
Run:
npm install -d
Laurel
5,99514 gold badges31 silver badges58 bronze badges
answered May 31, 2016 at 18:46
try re-install Node.js
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
and update npm
curl -L https://npmjs.com/install.sh | sudo sh
answered Dec 31, 2015 at 11:04
Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you’ll want to make sure it’s the latest version.
sudo npm install npm -g
Test:
npm -v //The version should be higher than 2.1.8
After this you should be able to run:
npm install
bruntime
3712 silver badges13 bronze badges
answered Sep 19, 2015 at 14:16
I found myself here trying to resolve the same error message:
npm ERR! message ENOENT, no such file or directory 'c:\<some_folder>\package.json'
The error could be due to two reasons:
- You do not have the package.json
- You have the
package.json
, but you are runningnpm start
in the wrong folder
To troubleshoot the first cause, you need to create a package.json using:
npm init
To fix the second cause, make sure the folder you are running the npm start
command is the same folder as the package.json
answered Dec 15, 2020 at 21:52
EarlyCoderEarlyCoder
1,2332 gold badges18 silver badges43 bronze badges
It may be very evident,
but try to launch CMD
(for Windows) from the project folder,
where your package.json file is located.
Do not launch CMD
from System or from «Search bar» in Win or
move to your project folder with help of cd
command and then launch npm start
.
answered Feb 1, 2017 at 12:44
rock_walkerrock_walker
4535 silver badges14 bronze badges
I had a similar problem with npm. The problem was that I had the project inside two folders of the same name. I resolved it by renaming one of the folders to something else (outer folder recommended).
g00glen00b
42.3k13 gold badges96 silver badges134 bronze badges
answered Jan 4, 2018 at 10:32
It by itself says that package.json
is not available in your project.
So, to create package.json
, use the following steps:
- open command prompt on your project directory
npm init
(it will ask you to enter lots of entries like name, version, desc, etc., enter some random values and click enter).- type
yes
and click enter
Now try again.
Marko Bonaci
5,6222 gold badges35 silver badges55 bronze badges
answered Jan 13, 2018 at 14:16
0
Go inside the project folder and check whether the package.json file does exist.
If you are creating the project using Visual Studio Angular project, make sure you run this command inside the ClientApp Folder. there is a good chance, you could be looking for project.json file outside the ClientApp folder.
answered Oct 15, 2018 at 3:28
1
if the package.json file in the project directory is missing then you can create it by
npm init.
if the package.json file is already created in the project directory then there is a possibility that you are not running your project from the right path.
Use cd your-project-path
in the terminal and then run your project from there.
answered Jul 6, 2019 at 12:34
npm init -y
use this command, it will automatically create package.json file with all your machine information.
answered May 1, 2020 at 8:22
I was experiencing this identical error and terminal (foolishly, on my part) was in a parent directory instead of the correct one (where package.json
was correctly located).
All I did in terminal was cd [insert correct directory name here, overwriting brackets]
and that corrected the problem.
answered Aug 6, 2021 at 18:55
Mark GavaganMark Gavagan
8781 gold badge12 silver badges45 bronze badges
1
Thank you!
I also tried many options for this. I am also using windows.This command helped and saved my time:
npm install -g npm@lts
answered Nov 4, 2016 at 13:56
bhattraidebbhattraideb
4077 silver badges25 bronze badges
ok, try to go to the home «user@user:~$ » (cd + enter key), and npm install -g your your_module.
answered May 22, 2017 at 22:35
just install any package you want with -g
npm install -g express
Nisarg
1,6316 gold badges19 silver badges31 bronze badges
answered Nov 7, 2018 at 15:36
prosper1prosper1
3042 silver badges9 bronze badges
0
For the following command
sudo npm install react browserify watchify babelify --save-dev
I got same error
saveError ENOENT: no such file or directory, open
‘/Users/Path/package.json’
But when I run the command
sudo npm install -gd react browserify watchify babelify --save-dev
then no missing file or directory message appeared.
answered Feb 10, 2016 at 12:44
zeeawanzeeawan
6,6872 gold badges50 silver badges56 bronze badges
I have run npm install -y
to skip the question step for creating the missing file package.json
, y
means yes
answered Mar 29, 2017 at 2:19
I was also facing same issue while installing typescript. I just initialized an package.josn file by the following command
npm init -y
And then i installed my typescript
npm install -g -typescript
http://blossomprogramming.blogspot.com/
answered Aug 16, 2017 at 10:33
Please check the directory or the folder in which you’re installing your new package.
This happened to me as well,
My whole project was in a subdirectory and I was trying to install in the main directory. After checking the whole thing I found out that I had to install in the subdirectory where my project files and package.json files are located and it’s done.
Hope this helps…
answered Feb 13, 2020 at 12:33
the previous tips do not pay attention to any change for me. at the end this works for me:
- delete the local repo folder
- git clone https … myRebo.git
- npm install
- npm start
hope it helps somebody
answered Sep 18, 2021 at 5:52
SL5netSL5net
2,3234 gold badges28 silver badges44 bronze badges
Adding -g before the package name worked for me. Looking for documentation to explain why this works..
answered Jun 4, 2017 at 19:02
Generate package.json without having it ask any questions. I ran the below comment in Mac and Windows under the directory that I would like to create package.json and it works
$ npm init -y
Wrote to C:\workspace\package.json:
{
"name": "workspace",
"version": "1.0.0",
"description": "",
"main": "builder.js",
"dependencies": {
"jasmine-spec-reporter": "^4.2.1",
"selenium-webdriver": "^4.0.0-alpha.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
answered Dec 28, 2019 at 18:49
ecamurecamur
991 silver badge4 bronze badges
When running npm commands from the terminal, you may get an error with code ENOENT
.
Here’s an example of the error message log when running the npm start
command:
$ npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /nsebhastian/Desktop/DEV/n-app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open
'/nsebhastian/Desktop/DEV/n-app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
As you can see, there’s an error with code ENOENT
that prevents npm start
command from running successfully.
The code ENOENT
means that npm fails to open a file or directory that’s required for executing the command.
The npm start
command is used to run the start
script in the package.json
file.
When the package.json
file isn’t found, then npm throws the ENOENT
error.
To fix the error, you need to make sure that the file or directory needed for running the command is available.
In the case above, adding a package.json
file to the project will solve the error.
If that doesn’t work, then you probably don’t have a start
script in your package.json
file.
Learn more here: How to fix npm start command not working
Also, make sure that you are running the command from the project directory, right where the package.json
file is located.
npm commands don’t work when you run them from a parent or child directory.
npm install fails with code ENOENT
The ENOENT
error may also appear when you run the npm install
command.
Here’s an example of the error:
$ npm install
npm ERR! path /Users/nsebhastian/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename
'/Users/nsebhastian/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates' -> '/Users/nsebhastian/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/.delegates.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The error above happens because you have a dependency that doesn’t install correctly.
Here are the steps to resolve this issue:
- Make sure you are using the latest npm version
- Clean your npm cache
- Delete
node_modules
folder andpackage-lock.json
- Run
npm install
again
Run the following commands one by one from the terminal:
# 👇 update npm to the latest version
npm install -g npm@latest
# 👇 clean npm cache
npm cache clean --force
# 👇 delete node modules and package-lock.json
npm rm -rf node_modules && rm package-lock.json
# 👇 retry installing dependencies
npm install
The npm install
command should now run successfully.
And that’s how you solve the npm error code ENOENT: no such file or directory error.
I installed supertest
before installing debug
and it fixed this error.
Maybe make it a dependency of this module?
No. That’s not an issue of debug
package.
I think it’s related to NPM v3’s changed installation behavior.
You can resolve that issue by following methods:
- Ensure dependencies described correctly on
package.json
- Just type
npm install
and hit Enter. - Check issue still exists. and If issue not resolved, continue these methods.
- type
npm cache clean
and hit Enter - type
sudo npm install -g npm
and hit Enter. - Retry
npm install
and hit Enter.
if issue not resolved even tried these methods, Please reply with your Node.js version, NPM version, Operating System, and package.json
which is using.
xgqfrms-GitHub, AprilTong, yyfsyw, isrvamsi, ordsec, jorditambillo, gkarmas, kika-deploy, alexreyes, sundoze, and 2 more reacted with laugh emoji
IgnacioGaldames, davidreact, Wajahat-Hussain, xmaimom, jmizrachi, fredriikolsson, Bogdan323, xgqfrms-GitHub, RichardChiang, nakhhuan, and 11 more reacted with hooray emoji
devope reacted with confused emoji
xgqfrms-GitHub, yolisa, rawairawai, yyfsyw, cameck, jacktnugent, gkarmas, alexreyes, sundoze, deivoff, and 3 more reacted with heart emoji
@mooyoul I have that problem and tried your solution. But my problem did not resolve.
I am using mac os 10.11.4 and Node 6.2.2 and npm 3.9.5
The node_modules is in user/muser/node_modules/
I see mysql package in this folder
But when I try nam install
, below message appears on terminal:
npm WARN enoent ENOENT: no such file or directory, open '/Users/muser/package.json'
npm WARN muser No description
npm WARN muser No repository field.
npm WARN muser No README data
npm WARN muser No license field.
There is no package.json at '/Users/muser/package.json'
What is wrong in my setup? and how can I fix it.
@FaShapouri It seems trying npm install
in uninitialized npm package directory.
you should initialize package with npm init
.
If you want to use debug without package initialize, just use npm install debug
.
Kriel, oumou318, kaleem-elahi, EliVerbrugge, alexreyes, Nako68l, and zrhth5 reacted with laugh emoji
zrhth5 reacted with hooray emoji
Jay25patil, kaleem-elahi, smoliakov, adilbekes, alexreyes, and zhaolinnan12 reacted with confused emoji
Simply try npm install npm@latest -g it worked for me cheers.
purefan reacted with thumbs down emoji
This module does not use supertest
, and thus is not an issue for debug. Closing.
Try to change your node.js version
i am having problem installing npm …it keep getting this:
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/jamesosaedebiri/package.json’
Indeed what it wants is a package.json file, obtained by typing npm init. Then I was able to do an npm install with success.
WARN enoent ENOENT: no such file or directory, open ‘/home/nodeuser/hapi-mysql-unchained/node_modules/request/package.json’
npm WARN hapi-mysql-unchained@1.0.0 No description
npm WARN hapi-mysql-unchained@1.0.0 No repository field.
npm ERR! Linux 4.4.0-36-generic
npm ERR! argv «/usr/bin/nodejs» «/usr/bin/npm» «install»
npm ERR! node v6.9.2
npm ERR! npm v4.2.0
npm ERR! path /home/nodeuser/hapi-mysql-unchained/node_modules/node-pre-gyp/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ‘/home/nodeuser/hapi-mysql-unchained/node_modules/node-pre-gyp/node_modules’
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access ‘/home/nodeuser/hapi-mysql-unchained/node_modules/node-pre-gyp/node_modules’
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/home/nodeuser/hapi-mysql-unchained/node_modules/node-pre-gyp/node_modules’ }
- node.js version — v7.7.1
- npm version — 4.3.0
- operating system ubuntu 14.04
- package.json at /home/faltu/package.json is not there
if you are pretty new to Node/github/etc., you might be doing what I did — cloned a repo and then forgot to cd into the repo directory — so npm can’t find a package.json file, so it gives you that big convoluted error message.
i was operating in my main ‘dev’ directory:
~/dev$ npm install
but i needed to be in my cloned git directory:
~/dev/quiztool$ npm install
EdwardPerello, alexreyes, and d88naimi reacted with hooray emoji
EdwardPerello, alexreyes, and d88naimi reacted with heart emoji
ubuntu@ubuntu:~$ npm install debug
npm ERR! Linux 4.8.0-22-generic
npm ERR! argv «/home/ubuntu/.nvm/versions/node/v7.7.2/bin/node» «/home/ubuntu/.nvm/versions/node/v7.7.2/bin/npm» «install» «debug»
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’
npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/npm-debug.log
you can try «npm install -g bootstrap@4.0.0-alpha.6», i did it successfully in this way.
Please try, npm install npm@latest -g
the output you will get as below
C:\Users*\AppData\Roaming\npm\npm -> C:\Users*\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users*****\AppData\Roaming\npm
-- npm@4.4.4 +-- abbrev@1.1.0 +-- ansi-regex@2.1.1 +-- ansicolors@0.3.2 +-- ansistyles@0.1.3 +-- aproba@1.1.1 +-- archy@1.0.0 +-- asap@2.0.5 +-- bluebird@3.5.0 +-- call-limit@1.1.0 +-- chownr@1.0.1 +-- cmd-shim@2.0.2 +-- columnify@1.5.4 |
— wcwidth@1.0.0
| -- defaults@1.0.3 |
— clone@1.0.2
+— config-chain@1.1.11
| -- proto-list@1.2.4 +-- debuglog@1.0.1 +-- dezalgo@1.0.3 +-- editor@1.0.0 +-- fs-vacuum@1.2.10 +-- fs-write-stream-atomic@1.0.10 +-- fstream@1.0.11 +-- fstream-npm@1.2.0 |
— fstream-ignore@1.0.5
| -- minimatch@3.0.3 |
— brace-expansion@1.1.6
| +— balanced-match@0.4.2
| -- concat-map@0.0.1 +-- glob@7.1.1 | +-- fs.realpath@1.0.0 | +-- minimatch@3.0.3 | |
— brace-expansion@1.1.6
| | +— balanced-match@0.4.2
| | -- concat-map@0.0.1 |
— path-is-absolute@1.0.1
+— graceful-fs@4.1.11
+— has-unicode@2.0.1
+— hosted-git-info@2.2.0
+— iferr@0.1.5
+— imurmurhash@0.1.4
+— inflight@1.0.6
+— inherits@2.0.3
+— ini@1.3.4
+— init-package-json@1.9.5
| -- promzard@0.3.0 +-- JSONStream@1.3.1 | +-- jsonparse@1.3.0 |
— through@2.3.8
+— lazy-property@1.0.0
+— lockfile@1.0.3
+— lodash._baseindexof@3.1.0
+— lodash._baseuniq@4.6.0
| +— lodash._createset@4.0.3
| -- lodash._root@3.0.1 +-- lodash._bindcallback@3.0.1 +-- lodash._cacheindexof@3.0.2 +-- lodash._createcache@3.1.2 +-- lodash._getnative@3.9.1 +-- lodash.clonedeep@4.5.0 +-- lodash.restparam@3.6.1 +-- lodash.union@4.6.0 +-- lodash.uniq@4.5.0 +-- lodash.without@4.4.0 +-- mississippi@1.3.0 | +-- concat-stream@1.6.0 | |
— typedarray@0.0.6
| +— duplexify@3.5.0
| | +— end-of-stream@1.0.0
| | | -- once@1.3.3 | |
— stream-shift@1.0.0
| +— end-of-stream@1.1.0
| | -- once@1.3.3 | +-- flush-write-stream@1.0.2 | +-- from2@2.3.0 | +-- parallel-transform@1.1.0 | |
— cyclist@0.2.2
| +— pump@1.0.2
| +— pumpify@1.3.5
| +— stream-each@1.2.0
| | -- stream-shift@1.0.0 |
— through2@2.0.3
| -- xtend@4.0.1 +-- mkdirp@0.5.1 |
— minimist@0.0.8
+— move-concurrently@1.0.1
| +— copy-concurrently@1.0.3
| -- run-queue@1.0.3 +-- node-gyp@3.5.0 | +-- minimatch@3.0.3 | |
— brace-expansion@1.1.6
| | +— balanced-match@0.4.2
| | -- concat-map@0.0.1 |
— nopt@3.0.6
+— nopt@4.0.1
| -- osenv@0.1.4 | +-- os-homedir@1.0.2 |
— os-tmpdir@1.0.2
+— normalize-git-url@3.0.2
+— normalize-package-data@2.3.6
| -- is-builtin-module@1.0.0 |
— builtin-modules@1.1.1
+— npm-cache-filename@1.0.2
+— npm-install-checks@3.0.0
+— npm-package-arg@4.2.1
+— npm-registry-client@7.4.6
| -- concat-stream@1.6.0 |
— typedarray@0.0.6
+— npm-user-validate@0.1.5
+— npmlog@4.0.2
| +— are-we-there-yet@1.1.2
| | -- delegates@1.0.0 | +-- console-control-strings@1.1.0 | +-- gauge@2.7.2 | | +-- object-assign@4.1.0 | | +-- signal-exit@3.0.2 | | +-- string-width@1.0.2 | | | +-- code-point-at@1.1.0 | | |
— is-fullwidth-code-point@1.0.0
| | | -- number-is-nan@1.0.1 | | +-- supports-color@0.2.0 | |
— wide-align@1.1.0
| -- set-blocking@2.0.0 +-- once@1.4.0 +-- opener@1.4.3 +-- osenv@0.1.4 | +-- os-homedir@1.0.2 |
— os-tmpdir@1.0.2
+— path-is-inside@1.0.2
+— read@1.0.7
| -- mute-stream@0.0.5 +-- read-cmd-shim@1.0.1 +-- read-installed@4.0.3 |
— util-extend@1.0.3
+— read-package-json@2.0.5
| -- json-parse-helpfulerror@1.0.3 |
— jju@1.3.0
+— read-package-tree@5.1.5
+— readable-stream@2.2.3
| +— buffer-shims@1.0.0
| +— core-util-is@1.0.2
| +— isarray@1.0.0
| +— process-nextick-args@1.0.7
| +— string_decoder@0.10.31
| -- util-deprecate@1.0.2 +-- readdir-scoped-modules@1.0.2 +-- realize-package-specifier@3.0.3 +-- request@2.81.0 | +-- aws-sign2@0.6.0 | +-- aws4@1.6.0 | +-- caseless@0.12.0 | +-- combined-stream@1.0.5 | |
— delayed-stream@1.0.0
| +— extend@3.0.0
| +— forever-agent@0.6.1
| +— form-data@2.1.2
| | -- asynckit@0.4.0 | +-- har-validator@4.2.1 | | +-- ajv@4.11.4 | | | +-- co@4.6.0 | | |
— json-stable-stringify@1.0.1
| | | -- jsonify@0.0.0 | |
— har-schema@1.0.5
| +— hawk@3.1.3
| | +— boom@2.10.1
| | +— cryptiles@2.0.5
| | +— hoek@2.16.3
| | -- sntp@1.0.9 | +-- http-signature@1.1.1 | | +-- assert-plus@0.2.0 | | +-- jsprim@1.3.1 | | | +-- extsprintf@1.0.2 | | | +-- json-schema@0.2.3 | | |
— verror@1.3.6
| | -- sshpk@1.11.0 | | +-- asn1@0.2.3 | | +-- assert-plus@1.0.0 | | +-- bcrypt-pbkdf@1.0.1 | | +-- dashdash@1.14.1 | | +-- ecc-jsbn@0.1.1 | | +-- getpass@0.1.6 | | +-- jodid25519@1.0.2 | | +-- jsbn@0.1.1 | |
— tweetnacl@0.14.5
| +— is-typedarray@1.0.0
| +— isstream@0.1.2
| +— json-stringify-safe@5.0.1
| +— mime-types@2.1.14
| | -- mime-db@1.26.0 | +-- oauth-sign@0.8.2 | +-- performance-now@0.2.0 | +-- qs@6.4.0 | +-- safe-buffer@5.0.1 | +-- stringstream@0.0.5 | +-- tough-cookie@2.3.2 | |
— punycode@1.4.1
| -- tunnel-agent@0.6.0 +-- retry@0.10.1 +-- rimraf@2.6.1 +-- semver@5.3.0 +-- sha@2.0.1 +-- slide@1.1.6 +-- sorted-object@2.0.1 +-- sorted-union-stream@2.1.3 | +-- from2@1.3.0 | |
— readable-stream@1.1.14
| | +— core-util-is@1.0.2
| | +— isarray@0.0.1
| | -- string_decoder@0.10.31 |
— stream-iterate@1.1.1
+— strip-ansi@3.0.1
+— tar@2.2.1
| -- block-stream@0.0.8 +-- text-table@0.2.0 +-- uid-number@0.0.6 +-- umask@1.1.0 +-- unique-filename@1.1.0 |
— unique-slug@2.0.0
+— unpipe@1.0.0
+— update-notifier@2.1.0
| +— boxen@1.0.0
| | +— ansi-align@1.1.0
| | | -- string-width@1.0.2 | | | +-- code-point-at@1.1.0 | | |
— is-fullwidth-code-point@1.0.0
| | | -- number-is-nan@1.0.1 | | +-- camelcase@4.0.0 | | +-- cli-boxes@1.0.0 | | +-- string-width@2.0.0 | | |
— is-fullwidth-code-point@2.0.0
| | +— term-size@0.1.1
| | | -- execa@0.4.0 | | | +-- cross-spawn-async@2.2.5 | | | |
— lru-cache@4.0.2
| | | | +— pseudomap@1.0.2
| | | | -- yallist@2.0.0 | | | +-- is-stream@1.1.0 | | | +-- npm-run-path@1.0.0 | | | +-- object-assign@4.1.1 | | | +-- path-key@1.0.0 | | |
— strip-eof@1.0.0
| | -- widest-line@1.0.0 | |
— string-width@1.0.2
| | +— code-point-at@1.1.0
| | -- is-fullwidth-code-point@1.0.0 | |
— number-is-nan@1.0.1
| +— chalk@1.1.3
| | +— ansi-styles@2.2.1
| | +— escape-string-regexp@1.0.5
| | +— has-ansi@2.0.0
| | -- supports-color@2.0.0 | +-- configstore@3.0.0 | | +-- dot-prop@4.1.1 | | |
— is-obj@1.0.1
| | -- unique-string@1.0.0 | |
— crypto-random-string@1.0.0
| +— is-npm@1.0.0
| +— latest-version@3.0.0
| | -- package-json@3.1.0 | | +-- got@6.7.1 | | | +-- create-error-class@3.0.2 | | | |
— capture-stack-trace@1.0.0
| | | +— duplexer3@0.1.4
| | | +— get-stream@3.0.0
| | | +— is-redirect@1.0.0
| | | +— is-retry-allowed@1.1.0
| | | +— is-stream@1.1.0
| | | +— lowercase-keys@1.0.0
| | | +— safe-buffer@5.0.1
| | | +— timed-out@4.0.1
| | | +— unzip-response@2.0.1
| | | -- url-parse-lax@1.0.0 | | |
— prepend-http@1.0.4
| | +— registry-auth-token@3.1.0
| | | -- rc@1.1.7 | | | +-- deep-extend@0.4.1 | | | +-- minimist@1.2.0 | | |
— strip-json-comments@2.0.1
| | -- registry-url@3.1.0 | |
— rc@1.1.7
| | +— deep-extend@0.4.1
| | +— minimist@1.2.0
| | -- strip-json-comments@2.0.1 | +-- lazy-req@2.0.0 | +-- semver-diff@2.1.0 |
— xdg-basedir@3.0.0
+— uuid@3.0.1
+— validate-npm-package-license@3.0.1
| +— spdx-correct@1.0.2
| | -- spdx-license-ids@1.2.0 |
— spdx-expression-parse@1.0.2
| +— spdx-exceptions@1.0.4
| -- spdx-license-ids@1.2.0 +-- validate-npm-package-name@3.0.0 |
— builtins@1.0.3
+— which@1.2.12
| -- isexe@1.1.2 +-- wrappy@1.0.2
— write-file-atomic@1.3.1
later install bootstrap, try below
$ npm install -g bootstrap@4.0.0-alpha.6
C:\Users******\AppData\Roaming\npm
-- bootstrap@4.0.0-alpha.6 +-- jquery@3.2.1
— tether@1.4.0
while publishing my package was having package.json… so why it is not downloaded when i am installing my package
New to node… setup EC2 > AMAZON linux.. Node setup.. tried all kinds of versions..
no matter what i do, errors are obtained during install..
tried npm init… tried diff versions of all parts… still I can’t get a successful install & test code always fails.
Errors below. Please advise
npm install pdfkit
npm WARN saveError ENOENT: no such file or directory, open ‘/home/ec2-user/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/home/ec2-user/package.json’
npm WARN ec2-user No description
npm WARN ec2-user No repository field.
npm WARN ec2-user No README data
npm WARN ec2-user No license field.
npm WARN ec2-user Invalid dependency: png-js undefined
No matter what I install or how, i get these:
npm WARN saveError ENOENT: no such file or directory, open ‘/home/ec2-user/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/home/ec2-user/package.json’
You have to cd into location where package.json is; like assets in phoenix 1.3.x
Angular 2 project not run forever show these errors:
npm ERR! path /package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open ‘/package.json’
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-05-30T12_02_40_976Z-debug.log
error: Forever detected script exited with code: 254
error: Script restart attempt #1
npm ERR! path /package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open ‘/package.json’
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
OS: Mac Sierra 10.12.5
Node v8.0.0.0
NPM v5.0.0
I’m having the same problem as well. I can’t seem to resolve this. I’ve tried both with and without sudo. I do have other programs installed in my computer. Don’t know if that has something to do with it. I have all of the Python Stack and Ruby Stack installed. Now trying to get all the MEAN Stack components installed.
Below is what I’m getting back. Any help would be greatly appreciated. When it talks about dependencies, I have no idea what that is.. Sorry for my poor knowledge.
TERMINAL:
Jaes-MacBook-Pro:bower_install jaepark75$ sudo npm install jquery
Password:
npm WARN saveError ENOENT: no such file or directory, open ‘/Users/jaepark75/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/jaepark75/package.json’
npm WARN jaepark75 No description
npm WARN jaepark75 No repository field.
npm WARN jaepark75 No README data
npm WARN jaepark75 No license field.
npm WARN jaepark75 Invalid dependency: balanced-match undefined
npm WARN jaepark75 Invalid dependency: block-stream undefined
npm WARN jaepark75 Invalid dependency: brace-expansion undefined
npm WARN jaepark75 Invalid dependency: concat-map undefined
npm WARN jaepark75 Invalid dependency: fs.realpath undefined
npm WARN jaepark75 Invalid dependency: fstream undefined
npm WARN jaepark75 Invalid dependency: glob undefined
npm WARN jaepark75 Invalid dependency: graceful-fs undefined
npm WARN jaepark75 Invalid dependency: hammerjs undefined
npm WARN jaepark75 Invalid dependency: inflight undefined
npm WARN jaepark75 Invalid dependency: inherits undefined
npm WARN jaepark75 Invalid dependency: materialize-css undefined
npm WARN jaepark75 Invalid dependency: minimatch undefined
npm WARN jaepark75 Invalid dependency: minimist undefined
npm WARN jaepark75 Invalid dependency: mkdirp undefined
npm WARN jaepark75 Invalid dependency: node-archiver undefined
npm WARN jaepark75 Invalid dependency: once undefined
npm WARN jaepark75 Invalid dependency: path-is-absolute undefined
npm WARN jaepark75 Invalid dependency: rimraf undefined
npm WARN jaepark75 Invalid dependency: tar undefined
npm WARN jaepark75 Invalid dependency: wrappy undefined
updated 1 package in 4.539s
Hi,
I’ve got the same problem here and tried to run the following commands above to fix this. «Clean Cache» & «re-install». Unfortunately it didn’t fix it for me. Seems to have spawned another issue.
/Users/Karbon62/.npm/_logs/2017-06-05T14_42_36_153Z-debug.log
Before running the commands to fix this, my console was giving me this error:
file:///Users/Karbon62/.npm/_logs/2017-06-05T12_47_17_209Z-debug.log
OS: Mac Sierra 10.12.5
Node v8.0.0.0
NPM v5.0.2
i’ve the same probelm than jimmymixer whitout sucess.
If any have a idea to dig… Thank
TERMINAL:
_MacBook-Air-de-happy:~ happy$ npm install airsonos -g
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated static-favicon@1.0.2: use serve-favicon module
npm WARN deprecated react-tools@0.13.3: react-tools is deprecated. For more information, visit https://fb.me/react-tools-deprecated
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/airsonos -> /usr/local/lib/node_modules/airsonos/bin/index.js
- airsonos@0.2.6_
then i installed latest «minimatch», «serve-favicon» and «react»
then
TERMINAL:
_MacBook-Air-de-happy:~ happy$ airsonos
Searching for Sonos devices on network…
/usr/local/lib/node_modules/airsonos/node_modules/bluebird/js/main/promise.js:680
throw e;
^
Error: Internal Server Error
at maybeWrapAsError (/usr/local/lib/node_modules/airsonos/node_modules/bluebird/js/main/util.js:70:12)
at /usr/local/lib/node_modules/airsonos/node_modules/bluebird/js/main/promise_resolver.js:41:50
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:112:20
at done (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:106:22
at done (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:251:17
at done (/usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:248:21
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:572:34
at /usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/events/volumeListener.js:24:14
at Listener. (/usr/local/lib/node_modules/airsonos/node_modules/sonos/lib/events/listener.js:123:9)
at Request.self.callback (/usr/local/lib/node_modules/airsonos/node_modules/request/request.js:129:22)_
-
Create a package.json file and store it in the folder where you will install the npm package. Keep it simple for now. This npm video helped me. Also read Using a package.json for additional information. The following example satisfies the minimum requirements:
{
«name»: «demo-app»,
«version»: «1.0.0»
} -
Open Terminal: as @mihai-ciupina pointed out… cd to the location where you want to store the package locally. If you type ls you should see the package.json file you just created.
-
Type: npm install <package_name>. The video above discusses variations you can type.
-
I’m not sure why, but my folder also created a package-lock.json file. I will have to do some more reading on this.
Im trying to install gulp and I keep having thises issues:
Ive tried many remedies including: npm install npm@latest and still no progress.
C:\Users\home>npm install npm@latest -g
C:\Users\home\AppData\Roaming\npm\npm -> C:\Users\home\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
- npm@5.0.3
updated 1 package in 24.356s
C:\Users\M-Corp>npm install gulp
npm WARN saveError ENOENT: no such file or directory, open ‘C:\Users\home\package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘C:\Users\home\package.json’
npm WARN home No description
npm WARN home No repository field.
npm WARN home No README data
npm WARN home No license field.
- gulp@3.9.1
updated 1 package in 2.495s
C:\Users\home>
u just need to create package.json file in the needing directory, and enter npm init
. It’s ok, and i tried successfully. Hope for u…
Did anyone find a solution to this yet? I highly doubt that they haven’t fixed this bug yet.
Simply remove node_modules then run again ‘npm install’
when i run
$ npm install express
, i got the following error.
rank@rank-ThinkCentre-M73:~$ npm install express
npm ERR! Linux 3.16.0-57-generic
npm ERR! argv «/home/rank/.nvm/versions/node/v5.0.0/bin/node» «/home/rank/.nvm/versions/node/v5.0.0/bin/npm» «install» «express»
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
npm ERR! Error: connect ECONNREFUSED 127.0.0.1:8080
npm ERR! at Object.exports._errnoException (util.js:860:11)
npm ERR! at exports._exceptionWithHostPort (util.js:883:20)
npm ERR! at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
npm ERR! { [Error: connect ECONNREFUSED 127.0.0.1:8080]
npm ERR! code: ‘ECONNREFUSED’,
npm ERR! errno: ‘ECONNREFUSED’,
npm ERR! syscall: ‘connect’,
npm ERR! address: ‘127.0.0.1’,
npm ERR! port: 8080 }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! ‘proxy’ config is set properly. See: ‘npm help config’
npm ERR! Please include the following file with any support request:
npm ERR! /home/rank/npm-debug.log
rank@rank-ThinkCentre-M73:~$
debug-js
locked and limited conversation to collaborators
Sep 5, 2017
debug
is not a repository to post your generic NPM-related problems; it’s a specific package that has nothing to do with most of the comments here.
Locking due to chatter. If you’re having lots of problems with NPM, might I suggest StackOverflow (please search first before asking a question). Alternatively, check out @mooyoul’s answer.
The npm ENOENT error can be tricky to resolve. This article will show you how to troubleshoot and fix the npm ENOENT no such file or directory error quickly.
What is the npm ENOENT Error?
The ENOENT error in npm stands for “Error NO ENTry“. It indicates that npm failed to find or open a required file or directory when running a command.
Some common npm commands that may fail with ENOENT error include:
npm start Failing with ENOENT
Running npm start
relies on having a package.json
file with a start
script. If this file is missing, npm will throw the ENOENT error saying it cannot find package.json
.
npm install Failing with ENOENT
The npm install
command fails with ENOENT when a dependency fails to install due to a missing file. This is often caused by a corrupted cache.
What causes the npm ERR! ENOENT error?
The main cause of the npm ENOENT error are:
- Missing package.json file – The npm start command relies on a package.json file being present in the current directory with a start script defined. If this file is missing, it will trigger the ENOENT error.
- Running npm commands from wrong directory – npm commands need to be run from the project root, where the package.json file is located. If you run npm install or npm start from the wrong folder, it can’t find package.json and throw ENOENT error.
- Outdated npm version – Bugs in old npm versions can also sometimes cause ENOENT errors unexpectedly. Updating to the latest npm usually fixes it.
- Corrupted cache – A corrupted npm cache can result in missing files or folders, leading to ENOENT errors. Clearing the cache fixes it.
- Incorrect file permissions – If the package.json file or node_modules folder has incorrect permissions and npm can’t access them, it could trigger the ENOENT error.
- Partial installs – If a dependency failed to install properly and is only partially present, it can cause ENOENT errors when npm tries to access it.
4 Fixes for npm ERR! ENOENT Errors
Here are four fixes that you can try to resolve this npm error:
1. Check the File Exists
If you get the ENOENT error when running npm start
, check that the package.json
file exists in the current directory. Open the folder in your code editor or file explorer to verify package.json
is present.
This file contains the start
script that npm start
tries to run. If it is missing, create a simple package.json
file with:
{
"scripts": {
"start": "node index.js"
}
}
Replace index.js
with the main file you want to run.
2. Run the command From Project Root
The npm CLI expects package.json
to be present in the current directory you run commands from.
Navigate to the root folder of your Node.js project which contains package.json
before running npm
commands.
For example, if your folder structure is project/app/src
, go to project
folder first before running npm install
.
3. Update npm
An outdated npm version can also trigger ENOENT errors unexpectedly.
Update to the latest stable npm release by running:
npm install -g npm@latest
This will install the newest npm version globally on your system. Try your npm
command again after updating.
4. Clear Cache and Reinstall
Corrupted cache can cause missing file errors like ENOENT.
Run the following commands step-by-step:
npm cache clean --force
rm -rf node_modules
npm install
This will:
- Clean the npm cache using
--force
flag - Delete the
node_modules
folder - Do a fresh install of all dependencies
Read more about clearing npm cache here : how to clear npm cache safely
After reinstalling, the missing files should be restored and ENOENT fixed.
Conclusion
With the above troubleshooting tips, you should be able to resolve the npm Err! ENOENT error quickly. Double-check for missing files, run npm
commands from the right folder, update npm and do a clean reinstall.
Related Articles:
Fix error:0308010C:digital envelope routines::unsupported
Solving “npm not recognized as an internal or external command” Error
(Fixed) npm ERR! missing script: start error
NVM Error – exit status 1: Access is denied – Fixed
Fixed Error – npm ERR! missing script: dev
npm WARN package.json: No repository field – Fix
Fixed Error: npm cannot find module error in NodeJS
How to fix “npm ERR cb() never called”