简体   繁体   中英

“Error: EACCES: permission denied” - running Meteor app (OHIF) on AWS EC2 Instance

I am running a Meteor application (a modified version of OHIF ) on an AWS EC2 Instance ( t2.medium running Amazon Linux 2).

When attempting to launch the application using meteor, or run any commands in meteor at all, I am seeing the below error. I have tried many different approaches based on other similar issues, primarily using chown to reassign ownership of all the indicated folders to ec2-user , but no matter what I try I keep getting this EACCES: permission denied error.

[ec2-user@ip-10-1-2-35 APPFolder]$ meteor npm install
/home/ec2-user/.meteor/packages/meteor-tool/.1.12.0.13oys96.0sq8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/cli/dev-bundle.js:120
         throw e;
         ^
 
 Error: EACCES: permission denied, stat
 '/Cansrdata/cansrohif/OHIFViewer/.meteor/local/dev_bundle'
     at Object.statSync (fs.js:1016:3)
     at statOrNull (/home/ec2-user/.meteor/packages/meteor-tool/.1.12.0.13oys96.0sq8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/cli/dev-bundle.js:117:21)
     at getDevBundleDir (/home/ec2-user/.meteor/packages/meteor-tool/.1.12.0.13oys96.0sq8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/cli/dev-bundle.js:37:25)
     at Object.<anonymous> (/home/ec2-user/.meteor/packages/meteor-tool/.1.12.0.13oys96.0sq8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/cli/dev-bundle.js:177:20)
     at Object.<anonymous> (/home/ec2-user/.meteor/packages/meteor-tool/.1.12.0.13oys96.0sq8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/cli/dev-bundle.js:180:3)
     at Module._compile (internal/modules/cjs/loader.js:1137:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
     at Module.load (internal/modules/cjs/loader.js:985:32)
     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
     at Module.require (internal/modules/cjs/loader.js:1025:19) {   errno: -13,   syscall: 'stat',   code: 'EACCES',   path:
 '/app/.meteor/local/dev_bundle' }

This happens no matter what I attempt. I have used the chown and chmod functions to reassign permissions for all directories and all files mentioned in the error log, as well as all directories and files which may be pointed to from those directories using relative links.

In the system (using ls -l) these all show as assigned to the default ec2-user user (which I believe from lots of googling / GitHub / Stack Overflow is the correct status, but I don't know for sure). I have also reinstalled meteor to see if this will change the permissions, without success.

The application was previously running on this EC2 Instance, so I am unsure why this doesn't work when I try it now.

Do you know why this is happening, and what I can do to fix it?

I was able to help Craig with that specific problem and it was done as follows:

The problem is meteor runs with root user (not recommended)

To get rid of this problem, stop the app servers, which in this case was tomcat with the command:

sudo systemctl stop tomcat.service

Optional Step: Just do it if you want for security reasons

  • cp -a local/home/ec2-user/meteor_local_copy

Go to your project folder:

  • cd myProject/.meteor/local
  • Warn: Delete only the /local directory (not /.meteor/local ):
  • There is no problem deleting, it will be re-created:
    • sudo rm -rf../myProject/.meteor/local

Now update your meteor:

meteor update

Wait until a message like this appears:

"Installed. Run 'meteor update --release 2.0' inside of a particular..."

In your project directory run:

meteor npm rebuild

Start the aplication server again:

systemctl start tomcat.service

Check if the problem was resolved!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM