Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

NPM errors after migrating project to a new Mac #773

Closed
swthate opened this issue Mar 18, 2016 · 7 comments
Closed

NPM errors after migrating project to a new Mac #773

swthate opened this issue Mar 18, 2016 · 7 comments

Comments

@swthate
Copy link

swthate commented Mar 18, 2016

Hi folks,

I got myself a new match (switching from iMac to MBP) and finally got most of my development environment set up. I then opened up one of my recent FP projects, typed npm run watch in the terminal and was greeted with some alarming errors (basically the same error when I attempt to run npm install, as well):

sh: /Users/.../foundationpress/node_modules/.bin/gulp: Permission denied

npm ERR! Darwin 15.3.0
npm ERR! argv "/Users/steven/.nvm/versions/node/v4.2.6/bin/node" "/Users/steven/.nvm/versions/node/v4.2.6/bin/npm" "run" "watch"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! foundationpress@2.4.0 watch: `gulp`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the foundationpress@2.4.0 watch script 'gulp'.
npm ERR! This is most likely a problem with the foundationpress 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 foundationpress
npm ERR! There is likely additional logging output above.

I installed node/npm according to this method: http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/ (same method used on my old iMac, which works fine). I realized I had a 5.x version of Node installed, so used nvm to add a 4.x version to work with FoundationPress.

I noticed in a few closed issues running a command to change git's git: to https:, but that didn't work.

Any other ideas? Thanks!!

@colin-marshall
Copy link
Collaborator

Did you try to get FoundationPress working in Node 5? It works for me with all versions of Node 5 that I have used.

There's also this:
https://docs.npmjs.com/getting-started/fixing-npm-permissions

@EricRihlmann
Copy link
Contributor

The problem is running npm install with a different version of Node from what you are using now. The easiest solution is to just rename or delete your current node_modules directory and rerun npm install with the version of Node that you plan on using for this project. The FoundationPress documentation recommends version 4.x, but as @colin-marshall mentioned version 5.xseems to work fine. The key is not mixing a major version of Node for the install, followed by another version for the build tasks.

Here is a tip, when using nvm you can drop a .nvmrc file containing only the Node version number in the root of your project. Now when you navigate to this project in terminal you can just run nvm use without specifying a version number.

Docs for using a .nvmrc file
https://github.com/creationix/nvm#usage

@swthate
Copy link
Author

swthate commented Mar 18, 2016

@colin-marshall Yes I originally attempted with Node 5.8.0, before I remembered the docs recommend v4.

@EricRihlmann Thank you, I should have thought of renaming/deleting the original node_modules dir! That worked like a charm, and I can confirm that I was able to run npm install with no errors using Node 5.8.0. And that's a really cool tip about the .nvmrc file. Thanks again!

@olefredrik
Copy link
Owner

Good stuff. Maybe we should include a .nvmrc file to the repo and include some info about nvm in the docs?

@colin-marshall
Copy link
Collaborator

@olefredrik I don't think we want to add nvmrc to the repo unless you leave it blank for the user to fill in the version number. If nvmrc allowed us to set a range of versions, like >v4, then we could use it but I think you can only specify one version.

Adding info about nvm, and nvmrc to the docs would be great though. Also I think you can remove the part that talks about issues with Node v5 and say that FoundationPress is compatible with Node v4 or v5. I haven't come across anybody with issues on v5.

@EricRihlmann
Copy link
Contributor

@olefredrik I came close to doing just that, but then I came to the same conclusion as @colin-marshall.

@thejwalker
Copy link

I had this problem as well - I ended up updating node via homebrew, deleted node_modules and re-ran npm install and then "npm run watch" ran without issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants