Closed albertusdev closed 6 years ago
Okay. Let's break this down:
Module not found: Error: Can't resolve '@babel/runtime/helpers/inheritsLoose' in '/home/adalberht/Code/YourProjectName/.cache'
It looks like babel helpers fail to install on your end. I'm not sure if npm add @babel/runtime
shouldn't really fixes it, since Gatsby 2 handles polyfills differently, and you might still be missing them from the build.
Quick fix is to add gatsby-link, after adding gatsby-link
gatsby-link
is deprecated in Gatsby v2.0 (which this starter is on right now). It looks like instead of gatsby@next
you got a Gatsby v1 package for some reason.
So far it looks like your NPM completely failed to properly resolve dependencies.
As for further troubleshooting:
1) Which NPM and NodeJS versions are you on? I'm unable to reproduce on:
npm 6.20
node v10.7.0
Over the last year most issues were actually NPM related issues that were fixed in the next NPM release. npm 5.x was horrible at actually resolving dependencies. Try upgrading if you aren't on the latest version.
2) If the above fails, also try yarn
. It was rather reliable during the past year and will remove the NPM package cache shenanigans from being a factor.
NOTE: During both steps make sure to nuke node_modules
, .cache
and public
in your project folder, since the first installation has clearly made a mess.
Oh wow it's just as you said! There was a problem with the NPM.
My NPM and NodeJS versions are as follow:
npm 5.6.0 node 9.7.0
And you are right, the first time I tried to install, my NPM did fail to properly resolve the dependencies (using the gatsby command), here's the error log:
gatsby new YourProjectName https://github.com/Vagr9K/gatsby-advanced-starter
info Creating new site from git: https://github.com/Vagr9K/gatsby-advanced-starter.git
Cloning into 'YourProjectName'...
remote: Counting objects: 2001, done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 2001 (delta 46), reused 75 (delta 34), pack-reused 1903
Receiving objects: 100% (2001/2001), 3.37 MiB | 861.00 KiB/s, done.
Resolving deltas: 100% (1158/1158), done.
success Created starter directory layout
info Installing packages...
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
> sharp@0.20.5 install /home/adalberht/YourProjectName/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
/home/adalberht/YourProjectName/node_modules/sharp/install/libvips.js:52
throw err;
^
Error: getaddrinfo ENOTFOUND github-production-release-asset-2e65be.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com:443
at errnoException (dns.js:55:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:26)
make: Entering directory '/home/adalberht/YourProjectName/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
#include <vips/vips8>
^~~~~~~~~~~~
compilation terminated.
sharp.target.mk:126: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/adalberht/YourProjectName/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/adalberht/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:160:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.15.0-29-generic
gyp ERR! command "/home/adalberht/.nvm/versions/node/v9.5.0/bin/node" "/home/adalberht/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/adalberht/YourProjectName/node_modules/sharp
gyp ERR! node -v v9.5.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
npm WARN gatsby-starter-advanced@1.1.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.20.5 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.20.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/adalberht/.npm/_logs/2018-07-23T17_25_45_046Z-debug.log
error Command failed: npm install
Error: Command failed: npm install
- index.js:236 Promise.all.then.arr
[lib]/[gatsby-cli]/[execa]/index.js:236:11
- util.js:16 tryCatcher
[lib]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18
- promise.js:614 Promise._settlePromise0
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
- promise.js:638 Promise._fulfill
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18
- promise_array.js:126 PromiseArray._resolve
[lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19
- promise_array.js:144 PromiseArray._promiseFulfilled
[lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14
- promise.js:574 Promise._settlePromise
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26
- promise.js:614 Promise._settlePromise0
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
- async.js:133 Async._drainQueue
[lib]/[gatsby-cli]/[bluebird]/js/release/async.js:133:16
- async.js:143 Async._drainQueues
[lib]/[gatsby-cli]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues [as _onImmediate]
[lib]/[gatsby-cli]/[bluebird]/js/release/async.js:17:14
FAIL: 1
After upgrading to npm 6.20
and node v10.7.0
, there was no issue at all.
Alright then, I'm going to close this issue then.
Thank you very much!
Hi there, I tried this starter repo by using two of the methods in the README (using gatsby new and git clone), and both of them results in an error while running develop.
After googling for a little bit, I think the quickfix is to run:
npm add @babel/runtime
But after doing this, another error rose.
Quick fix is to add
gatsby-link
, after addinggatsby-link
, Another problem rose:The fix is to add
gatsby-react-router-scroll
.TL;DR:
What do you think? Should I send a pull request to update the
package.json
?Awesome work btw. Thanks!