Menu icon Foundation
Sudo, no sudo, root or..?

Hi

I'm familiar with Foundation for Sites but am new to apps. Running OSx10.10 for development. The benefits of shifting to the apps framework is hard to ignore, however having a few hiccups getting started with permissions.

I have got as far as creating with the CLI a new app, and running it and looking at the default template in my browser. But what I'm confused about is permissions.

After creating the app and running npm start it all looks fine. Then I attempt to create a new file in sublime, like about.html and I'm hit with permission denied.

I'm assuming because I'm creating the app in root, my user that I'm loading sublime with doesn't have access to create new files in that directory.

What is the best practice then for permissions of client/templates/*?

If I try and create the app while not in root, it creates the app ok, but I can't run the server. I get the output:

Error: Cannot find module './bower_components/foundation-apps/bin/gulp-dynamic-routing'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/Mercury/apps/ribbet/gulpfile.js:20:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

npm ERR! [email protected] start: `gulp`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the foundation-apps-template package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get their info via:
npm ERR! npm owner ls foundation-apps-template
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /Users/Mercury/apps/ribbet
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Mercury/apps/ribbet/npm-debug.log
npm ERR! not ok code 0

So is my gulp broken?

I've read something about gulp won't run in sudo. However even if I log into root, and then do a 'foundation-apps watch' on an app that was not created in root the server won't start giving the same error above.

What am I missing here? Any ideas or pointers to a guide for a lessor mortals like myself? Should node be installed from root? bower? bundler? etc etc... For a newb coming into this it's pretty tricky.

Thanks for any pointers

sudoROOTerrorpermissions

Hi

I'm familiar with Foundation for Sites but am new to apps. Running OSx10.10 for development. The benefits of shifting to the apps framework is hard to ignore, however having a few hiccups getting started with permissions.

I have got as far as creating with the CLI a new app, and running it and looking at the default template in my browser. But what I'm confused about is permissions.

After creating the app and running npm start it all looks fine. Then I attempt to create a new file in sublime, like about.html and I'm hit with permission denied.

I'm assuming because I'm creating the app in root, my user that I'm loading sublime with doesn't have access to create new files in that directory.

What is the best practice then for permissions of client/templates/*?

If I try and create the app while not in root, it creates the app ok, but I can't run the server. I get the output:

Error: Cannot find module './bower_components/foundation-apps/bin/gulp-dynamic-routing'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/Mercury/apps/ribbet/gulpfile.js:20:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

npm ERR! [email protected] start: `gulp`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the foundation-apps-template package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get their info via:
npm ERR! npm owner ls foundation-apps-template
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /Users/Mercury/apps/ribbet
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Mercury/apps/ribbet/npm-debug.log
npm ERR! not ok code 0

So is my gulp broken?

I've read something about gulp won't run in sudo. However even if I log into root, and then do a 'foundation-apps watch' on an app that was not created in root the server won't start giving the same error above.

What am I missing here? Any ideas or pointers to a guide for a lessor mortals like myself? Should node be installed from root? bower? bundler? etc etc... For a newb coming into this it's pretty tricky.

Thanks for any pointers

Geoff Kimball over 4 years ago

Did you use sudo to run the foundation-apps new command? That may be your issue.

Running the installer as sudo will grant admin rights to every step of the process, most importantly git clone. Performing a git clone as root means that the admin user owns the files in the clone, which is why you're getting those issues.

We'd recommend running foundation-apps new as a normal user to avoid these issues. However, you might still run into trouble if your Node install is configured in such a way that you need admin privileges to install software. We're hoping to figure out a way to detect in the CLI if Node errors out because it needs admin rights, but it's kind of a tricky problem to solve.

If you can't get the installer working, you can also install manually. This will also help you figure out which step in the install process is going wrong. The instructions are on the readme for the template stack.

Robert North over 4 years ago

I was trying every variation of running with and without sudo, to my feeble knowledge. To be honest after a day I gave up, very sad, but bruce my cat cheered me up.

Following this manual installation on githup you linked it works perfectly! Wish I found that sooner.

If there were a way to detect in CLI all that you said it would be great. As a newcomer to this it was really overwhelming and hard to debug. The instructions casually suggest if you're having troubles with commands try Sudo etc. I also learned (since i'm on mac) that the Ruby I was using by default may have been broken. I ended up installing some 2nd rbenv version. I just felt like a dog chasing his tail.

Well, thanks for that link for the readme - it helped a lot.

Rafi Benkual over 4 years ago

Glad you got it! I don't know if the CLI can detect that. At some point it becomes pretty difficult to account for all the different configurations and possibilities. Anyways, thanks to @geoff for the manual install link.

Robert North over 4 years ago

I just wanted to follow this up, because I would like to get my system configured properly to take advantage of the CLI.

Geoff said "If you can't get the installer working, you can also install manually. This will also help you figure out which step in the install process is going wrong. The instructions are on the readme for the template stack."

What do I know now that the manual installation works fine?

I've just tried:

foundation-apps new postmanual
cd postmanual
foundation-apps watch

Which returns:
```Error: Cannot find module './bower_components/foundation-apps/bin/gulp-dynamic-routing'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/Mercury/apps/postmanual/gulpfile.js:20:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

npm ERR! [email protected] start: gulp
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the foundation-apps-template package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get their info via:
npm ERR! npm owner ls foundation-apps-template
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /Users/Mercury/apps/postmanual
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Mercury/apps/postmanual/npm-debug.log
npm ERR! not ok code 0
```

Geoff you also mentoned "However, you might still run into trouble if your Node install is configured in such a way that you need admin privileges to install software."

I've been trying to find out if this is the case - I went through the node installation process again installing a the package from node.js - is there a better way to go about this or way I can check?

Robert North over 4 years ago

In case anybody has the same issue I had, I was eventually able to solve it by fixing my bower install.

I guess bower was installed as root at some stage, which in my case was problematic. When I went to install bower stuff into my apps it wouldn't have permission, throwing errors like:

Stack trace:
Error: EACCES,

In my situation, there were folders like ~/.cache/bower/ which were owned by root. I deleted 'bower' in .cache, but it wasn't enough. I needed to delete .cache as well.

There is a CL for this as well, such as: sudo bower cache clean

But for me this wasn't enough. In the end I just removed the whole ~/.cache folder because it was owned by root with sudo rm -fr ~/.cache

Then from my non-sudo account, reinstalled bower with global: npm install -g bower

Now I can create app with foundation-apps new appName and watch the app and no errors are thrown.

Hope it helps if you're new to all this like I am.