create-react-app fails with permission denied
I'm getting a weird error:
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/ubuntu/.npm/_cacache/index-v5/14/36'atus
I just install npm (6.4.1) and node (11.2.0) on an AWS instance without problems. I installed create-react-app globally. The error says This is an error with npm itself.
I'm kind of at a loss. I created the directory /home/ubuntu/.npm/_cacache/index-v5/14 and it still wouldn't succeed. I obviously own and have write permissions in /home/ubuntu.
It looks like it succeeds with sudo. why ?
Edit: ubuntu:ubuntu owns the current and parent directory (I'm in /home/ubuntu/workspace)
node.js linux reactjs
add a comment |
I'm getting a weird error:
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/ubuntu/.npm/_cacache/index-v5/14/36'atus
I just install npm (6.4.1) and node (11.2.0) on an AWS instance without problems. I installed create-react-app globally. The error says This is an error with npm itself.
I'm kind of at a loss. I created the directory /home/ubuntu/.npm/_cacache/index-v5/14 and it still wouldn't succeed. I obviously own and have write permissions in /home/ubuntu.
It looks like it succeeds with sudo. why ?
Edit: ubuntu:ubuntu owns the current and parent directory (I'm in /home/ubuntu/workspace)
node.js linux reactjs
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28
add a comment |
I'm getting a weird error:
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/ubuntu/.npm/_cacache/index-v5/14/36'atus
I just install npm (6.4.1) and node (11.2.0) on an AWS instance without problems. I installed create-react-app globally. The error says This is an error with npm itself.
I'm kind of at a loss. I created the directory /home/ubuntu/.npm/_cacache/index-v5/14 and it still wouldn't succeed. I obviously own and have write permissions in /home/ubuntu.
It looks like it succeeds with sudo. why ?
Edit: ubuntu:ubuntu owns the current and parent directory (I'm in /home/ubuntu/workspace)
node.js linux reactjs
I'm getting a weird error:
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/ubuntu/.npm/_cacache/index-v5/14/36'atus
I just install npm (6.4.1) and node (11.2.0) on an AWS instance without problems. I installed create-react-app globally. The error says This is an error with npm itself.
I'm kind of at a loss. I created the directory /home/ubuntu/.npm/_cacache/index-v5/14 and it still wouldn't succeed. I obviously own and have write permissions in /home/ubuntu.
It looks like it succeeds with sudo. why ?
Edit: ubuntu:ubuntu owns the current and parent directory (I'm in /home/ubuntu/workspace)
node.js linux reactjs
node.js linux reactjs
edited Nov 24 '18 at 7:27
xyious
asked Nov 24 '18 at 6:28
xyiousxyious
4322719
4322719
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28
add a comment |
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28
add a comment |
1 Answer
1
active
oldest
votes
TL;TR
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM
and NodeJS
are installed globally with sudo
and the owner of that files is the root and usually a user can only read/execute that packages. When NPM
is stalled a ~/.npm/ folder is created by the root. By running create-react-app
you are executing the command as user and create-react-app
is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo
privileges.
Often similar thing happens when you install NPM
package with sudo
e.g. sudo npm install <package> --save
. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo
infrnt of NPM
you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER .
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455753%2fcreate-react-app-fails-with-permission-denied%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
TL;TR
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM
and NodeJS
are installed globally with sudo
and the owner of that files is the root and usually a user can only read/execute that packages. When NPM
is stalled a ~/.npm/ folder is created by the root. By running create-react-app
you are executing the command as user and create-react-app
is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo
privileges.
Often similar thing happens when you install NPM
package with sudo
e.g. sudo npm install <package> --save
. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo
infrnt of NPM
you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER .
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
add a comment |
TL;TR
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM
and NodeJS
are installed globally with sudo
and the owner of that files is the root and usually a user can only read/execute that packages. When NPM
is stalled a ~/.npm/ folder is created by the root. By running create-react-app
you are executing the command as user and create-react-app
is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo
privileges.
Often similar thing happens when you install NPM
package with sudo
e.g. sudo npm install <package> --save
. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo
infrnt of NPM
you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER .
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
add a comment |
TL;TR
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM
and NodeJS
are installed globally with sudo
and the owner of that files is the root and usually a user can only read/execute that packages. When NPM
is stalled a ~/.npm/ folder is created by the root. By running create-react-app
you are executing the command as user and create-react-app
is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo
privileges.
Often similar thing happens when you install NPM
package with sudo
e.g. sudo npm install <package> --save
. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo
infrnt of NPM
you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER .
TL;TR
Run:
sudo chown -R $USER:$USER '/home/ubuntu/.npm/'
On Linux OS NPM
and NodeJS
are installed globally with sudo
and the owner of that files is the root and usually a user can only read/execute that packages. When NPM
is stalled a ~/.npm/ folder is created by the root. By running create-react-app
you are executing the command as user and create-react-app
is trying to modify something in the ~/.npm/ directory which is owned by the root and not to current user. You need to change the owner of that directory to you, so you can modify it without sudo
privileges.
Often similar thing happens when you install NPM
package with sudo
e.g. sudo npm install <package> --save
. Again the newly installed package in owned by the root and for example when you try to update/modufy/delete your project without sudo
infrnt of NPM
you will have similar permission error. In these cases navigate to your project directory and change its owner by running:
sudo chown -R $USER:$USER .
edited Nov 24 '18 at 7:43
answered Nov 24 '18 at 6:58
Nedko DimitrovNedko Dimitrov
478515
478515
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
add a comment |
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
1
1
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
+1 .... apparently when the first thing I install is with sudo and -g the /home/user/.npm folder isn't owned by me.
– xyious
Nov 24 '18 at 7:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455753%2fcreate-react-app-fails-with-permission-denied%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try installing NodeJS with NVM. You won't face problems with permissions
– Tico
Nov 24 '18 at 6:32
Try on the command line the following shell command: mkdir - p '/home/ubuntu/.npm/_cacache/index-v5/14/36' however, make sure you run the command with the same user ID that you use for the installation. That is just for a quick test! Ops, one more thing to add. You mentioned that you have the answer already :) "It looks like it succeeds with sudo." OK, sudo has write privileges across the entire file system.
– Krassi Em
Nov 24 '18 at 6:40
What is the owner and permission of this directory, and the recursively parent directory?
– Geno Chen
Nov 24 '18 at 6:44
added comment, current users owns (and as I said has write permissions) in the current directory
– xyious
Nov 24 '18 at 7:28