sintaxi/harp

unable to install with npm: errors from outdate or changed dependencies

tbrowder opened this issue · 23 comments

OS: Debian 10 (Buster)

$ npm -v
6.10.3
$ node -v
v12.10.0
$ cd harp-fork
$ npm install .
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/bin/npm', 'install', '.' ]
2 info using npm@6.10.3
3 info using node@v12.10.0
4 verbose npm-session 98e928c71337fd3b
...
1452 verbose stack Error: node-sass@4.9.3 postinstall: `node scripts/build.js`
1452 verbose stack Exit status 1
1452 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
1452 verbose stack     at EventEmitter.emit (events.js:209:13)
1452 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
1452 verbose stack     at ChildProcess.emit (events.js:209:13)
1452 verbose stack     at maybeClose (internal/child_process.js:1021:16)
1452 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
1453 verbose pkgid node-sass@4.9.3
1454 verbose cwd /usr/local/git-repos/forks/harp
1455 verbose Linux 4.19.0-6-amd64
1456 verbose argv "/usr/bin/node" "/bin/npm" "install" "."
1457 verbose node v12.10.0
1458 verbose npm  v6.10.3
1459 error code ELIFECYCLE
1460 error errno 1
1461 error node-sass@4.9.3 postinstall: `node scripts/build.js`
1461 error Exit status 1
1462 error Failed at the node-sass@4.9.3 postinstall script.
1462 error This is probably not a problem with npm. There is likely additional logging output above.
1463 verbose exit [ 1, true ]

I am a complete node/npm novice, but I have too much invested in my harp website to not at least try to fix it.

Have you abandoned harp?

Additional debugging with npm audit indicates a problem also with terraform.

Seems that it does not work with node v12 #648. Try with node v10. I am not sure if they are willing to continue it.

Do you have a good suggestion for an alternative static gen system? What do you think of Jekyll?

@tbrowder I have not consider other options yet, but maybe this site might help https://www.staticgen.com

Thanks, that site is the genesis of my question about Jekyll. Looks kile a good alternative, but only if Harp is abandoned.

Thanks, Brock!

@tbrowder just released harp v0.31.0 please test install and let me know if this issue is resolved.

Stiil have a problem:

Downloaded and unpacked harp-0.31.0.tar.gz:

$ sudo npm install -g harp-0.31.0
/usr/bin/harp -> /usr/lib/node_modules/harp/bin/harp
+ harp@0.31.0
updated 1 package in 2.073s
root@juvat3:/home/tbrowde/Downloads# ls
Date-Calc-6.4.tar.gz	       assets.tar.gz			       invoice.pdf				pandoc-2.7.3-1-amd64.deb
Expirion-20190727-amd54.iso    google-chrome-stable_current_amd64.deb  map-113-canterbury-circle-niceville.pdf	tp-link-TL-SG108E-v3
Expirion-20190727-desktop.png  harp-0.31.0			       node-v12.11.1-linux-x64.tar.xz
algo-master.zip		       harp-0.31.0.tar.gz		       package-lock.json
root@juvat3:/home/tbrowde/Downloads# npm install -g harp-0.31.0
/usr/bin/harp -> /usr/lib/node_modules/harp/bin/harp
+ harp@0.31.0
updated 1 package in 2.041s

Get the version:

$ harp -V
fs.js:130
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/vendor'
    at Object.readdirSync (fs.js:865:3)
    at Object.getInstalledBinaries (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/extensions.js:131:13)
    at foundBinariesList (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/home/tbrowde/Downloads/harp-0.31.0/node_modules/node-sass/vendor'
}

Hmm, I can't seem to replicate this problem. I'm using the same version of node and npm. Installation works fine for me.

It works fine for me. Thanks @sintaxi

I see the problem references terraform, so I tried to install it from the latest tarball: no luck. All the installs keep failing around nod-sass with weird errors about unable to create dirs, etc. I am running as root and don't understand that. And on it goes.

Is there any place a node noob can go for help? The #node and #node-jc IRC channels seem inactive.

Questions for those who have had success:

  1. What OS?
  2. Exactly how did you install harp? Please show the steps you took.

Here's what I just tried:

  1. I uninstalled node and reinstalled node 10+
  2. I cloned both the harp and the terraform repos
  3. I changed to the directory containing the two repos
  4. I then executed:
$ sudo npm install -g terraform
+ terraform@1.9.0
added 1 package from 25 contributors in 0.741s
$ sudo npm install -g harp     
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated classifier@0.1.0: Package no longer supported. Contact support@npmjs.com for more info.
/usr/bin/harp -> /usr/lib/node_modules/harp/bin/harp
npm WARN lifecycle node-sass@4.12.0~install: cannot run in wd node-sass@4.12.0 node scripts/install.js (wd=/usr/local/git-repos/forks/harp/node_modules/node-sass)
npm WARN lifecycle core-js@2.6.9~postinstall: cannot run in wd core-js@2.6.9 node scripts/postinstall || echo "ignore" (wd=/usr/local/git-repos/forks/harp/node_modules/core-js)
npm WARN lifecycle node-sass@4.12.0~postinstall: cannot run in wd node-sass@4.12.0 node scripts/build.js (wd=/usr/local/git-repos/forks/harp/node_modules/node-sass)
+ harp@0.31.0
added 623 packages from 590 contributors in 22.179s

Checking the installation:

$ ls /usr/lib/node_modules
harp  npm  terraform
$ harp
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/usr/local/git-repos/forks/harp/node_modules/node-sass/vendor'
    at Object.readdirSync (fs.js:790:3)
    at Object.getInstalledBinaries (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/extensions.js:131:13)
    at foundBinariesList (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

Success with a hack: looking at the top line of the error shown above, I tried creating the missing directory manually. Then I retried executing harp again and got:

$ cd usr/local/git-repos/forks/harp/node_modules/node-sass
$ sudo mkdir vendor
$ harp
/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/binding.js:15
      throw new Error(errors.missingBinary());
      ^

Error: Missing binding /usr/local/git-repos/forks/harp/node_modules/node-sass/vendor/linux-x64-64/binding.node

Then I created the missing directory and ran harp again:

$ cd vendor
$ sudo mkdir linux-x64-64
$ harp
/usr/local/git-repos/forks/harp/node_modules/node-sass/lib/binding.js:15
      throw new Error(errors.missingBinary());
      ^

Error: Missing binding /usr/local/git-repos/forks/harp/node_modules/node-sass/vendor/linux-x64-64/binding.node

I used command locate to find any binding.node files and found one which I copied to that harp repo directory and then, as if by magic, harp worked!

It seems that, for whatever reason, the sass installation doesn't know how to bind to the libsass-dev library on a linux 64-bit system. I was just lucky enough to have one in another repo.

I have no idea how to fix the situation or what is really causing the problem. I hope Brock can find the root cause and file the issue in the right place.

I'm confused by a few things; just reading through it now.

  1. Why are you running a fork?
  2. Why are you installing them from github? Why not npm install -g harp
  3. I'm generally a little confused about what you are attempting to do, so it also makes it hard to guess what I need to know more about to help you.

@tbrowder perhaps you can expand?

Because running "npm install -g harp" doesn't find this harp, it finds another.

note4 commented

I'm looking forward to an update from harp authors, many of whom have experienced installation failures.

Harp is currently a mess when trying to install via npm. Pity looks really promising

@drewwebster @note4 Can you tell me what version of node are you using? Can you tell me what OS you are on? Are you able to provide a stacktrace of the error you see on installation?

Hello everyone. I had the same problem today while trying to install harp through npm. Luckily, I could work around the issue by using yarn instead of the default installation method. Here's what I did:

npm install -g yarn
yarn global add harp

And that's all it took, really. I hope this helps others in the same situation. Maybe it's a good idea to update the website and include the alternate installation method.

@sintaxi By the way, thank you so much for such an awesome piece of software!

Harp has had a lot of work lately and all security issues have been addressed. Harp now installs without any warnings...

harp-install

On another note, harp got an updated CLI, and now does zero-configuration bundling for .cjs and .jsx files. The latest version of harp (0.41.0) is only 18MB! - down from 85M (0.29.0).

Harp is better than ever. Closing this issue.