olefredrik / FoundationPress

FoundationPress is a WordPress starter theme based on Foundation 6 by Zurb
https://foundationpress.olefredrik.com
MIT License
2.7k stars 867 forks source link

Error with gulp while npm install #1322

Closed derweili closed 6 years ago

derweili commented 6 years ago

Recently I get an error while running npm install. Is error ist related to gulp.

How can this bug be reproduced?

  1. clone FoundationPress
  2. run npm install

What happened While installing all npm dependencies I get following error:

WerbeagtensiMac:FoundationPress werbeagenten$ npm install
Unhandled rejection Error: Command failed: /usr/bin/git checkout 4.0ract fancy-log@1.3.2
error: pathspec '4.0' did not match any file(s) known to git.

    at ChildProcess.exithandler (child_process.js:198:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)

My Solution I was able to solve this error by removing the #4.0 at the gulp devDependencies.

https://github.com/olefredrik/FoundationPress/blob/b0bc01e3bfc8640771a47f9cc9cbe632205d43d7/package.json#L42

Please List the Following:

melek commented 6 years ago

I also solved this issue manually, though I did it by replacing the line with: "gulp": "^4.0",

I'm not proficient enough with npm to understand why both worked and which solution is the 'correct' one, but wanted to add my experience in case it informs a better bugfix.

dantahoua commented 6 years ago

Same here... Depending of the npm version (I use nvm), error is sightly different but always around this gulp 4.0... With node 6.11.5 I have:

npm ERR! git rev-list -n1 4.0: fatal: ambiguous argument '4.0': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 4.0: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 4.0: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 4.0: 
npm ERR! git rev-list -n1 4.0: fatal: ambiguous argument '4.0': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 4.0: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 4.0: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 4.0: 
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
...
..
.
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code 128

npm ERR! Command failed: git clone --template=/Users/studio12/.npm/_git-remotes/_templates --mirror git@github.com:gulpjs/gulp.git /Users/studio12/.npm/_git-remotes/git-github-com-gulpjs-gulp-git-4-0-7c06e801
npm ERR! Cloning into bare repository '/Users/studio12/.npm/_git-remotes/git-github-com-gulpjs-gulp-git-4-0-7c06e801'...
npm ERR! Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

Seems the repository is not here, or an access problem/authorization...

Note that using the command npm install 'gulpjs/gulp.git#4.0' --save-dev ends up withthe same error...

From the last comment on this issue, seems the 4.0 branch is no more there... :( https://github.com/gulpjs/gulp/issues/2078

dantahoua commented 6 years ago

I found it after reading this post on the Gulp GIT : https://github.com/gulpjs/gulp/issues/1486 Yo have to replace the gulp line in package.json with "gulp": "next", Note that even if it's working I still have also Failed to load external module @babel/register message when starting with npm start. Babel-register is installed, don't understand this one... If using node 8.12, no problem with Babel-register. Maybe a pullrequest to correct the package.json? I'm not able to make the pull request...

neilwave commented 6 years ago

Same here:

npm install following error:

Unhandled rejection Error: Command failed: /usr/bin/git checkout 4.0locks/sta error: pathspec '4.0' did not match any file(s) known to git.

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:554:12)`

OS ElCapitan 10.11.6 Node v.8.9.4 Foundation Press Version: 2.10.4

derweili commented 6 years ago

I found it after reading this post on the Gulp GIT : https://github.com/gulpjs/gulp/issues/1486 Yo have to replace the gulp line in package.json with "gulp": "next",

I don't think "next" is the right version to reference. "next" does not reference to a unique version but to the latest stable version. This version will change in the future. Using "next" could cause incompatibility problems when gulp has breaking changes in upcoming versions.

That's why i prefer @melek's solutions:

I also solved this issue manually, though I did it by replacing the line with: "gulp": "^4.0",

neilwave commented 6 years ago

I tested an older installation i had (same Foundation Press Version, 2.10.4), just copied all files into the new folder were i had the Unhandled rejection Error before and npm start, npm build are running well. package.json: line 42: "gulp": "gulpjs/gulp#4.0", is unchanged.

But that can´t be the solution.

Next try: I overlocked that my current node version was higher than recommended, so i downgraded it to 6.11.5. Changed package.json "gulp": "^4.0" (like @melek)

now it´s running

olefredrik commented 6 years ago

https://github.com/olefredrik/FoundationPress/pull/1327