Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the submodule tidy-html5 to version 5.6 #22

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

prantlf
Copy link

@prantlf prantlf commented Feb 25, 2018

Fixes #21.

@cainrus
Copy link

cainrus commented Jul 16, 2018

Current version npm i [email protected] works well.
But new version fails:

➜ node -v
v10.5.0

➜ npm -v
6.1.0

➜ npm i gagern/node-libtidy#1ee5b88

> [email protected] install /Users/serg/projects/leonweb/node_modules/libtidy
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/gagern/node-libtidy/releases/download/v0.3.8/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/gagern/node-libtidy/releases/download/v0.3.8/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp: /Users/serg/projects/leonweb/node_modules/libtidy/build/config.gypi not found (cwd: /Users/serg/projects/leonweb/node_modules/libtidy) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/serg/.nvm/versions/node/v10.5.0/bin/node" "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/serg/projects/leonweb/node_modules/libtidy/lib/tidy.node" "--module_name=tidy" "--module_path=/Users/serg/projects/leonweb/node_modules/libtidy/lib"
gyp ERR! cwd /Users/serg/projects/leonweb/node_modules/libtidy
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/serg/.nvm/versions/node/v10.5.0/bin/node /Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/serg/projects/leonweb/node_modules/libtidy/lib/tidy.node --module_name=tidy --module_path=/Users/serg/projects/leonweb/node_modules/libtidy/lib' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/serg/projects/leonweb/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/Users/serg/.nvm/versions/node/v10.5.0/bin/node" "/Users/serg/projects/leonweb/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/serg/projects/leonweb/node_modules/libtidy
node-pre-gyp ERR! node -v v10.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute '/Users/serg/.nvm/versions/node/v10.5.0/bin/node /Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/serg/projects/leonweb/node_modules/libtidy/lib/tidy.node --module_name=tidy --module_path=/Users/serg/projects/leonweb/node_modules/libtidy/lib' (1)
Traceback (most recent call last):fo lifecycle [email protected]~install: Failed to exec install script
  File "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 502, in gyp_main
    'cwd': os.getcwd(),
OSError: [Errno 2] No such file or directory
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/serg/.nvm/versions/node/v10.5.0/bin/node" "/Users/serg/.nvm/versions/node/v10.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/serg/projects/leonweb/node_modules/libtidy/lib/tidy.node" "--module_name=tidy" "--module_path=/Users/serg/projects/leonweb/node_modules/libtidy/lib"
gyp ERR! cwd /Users/serg/projects/leonweb/node_modules/libtidy
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of vue-template-compiler@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     /Users/serg/.npm/_logs/2018-07-16T10_41_51_920Z-debug.log

@prantlf
Copy link
Author

prantlf commented Jul 21, 2018

It appears, that something changed, when running with NodeJS 10. When I run npm i, the command node-pre-gyp install --fallback-to-build fails with "Error: You must run node-gyp configure first!". When I run node-pre-gyp rebuild, it succeeds. Then re-reunning npm i succeeds too.

Cloning works well.

$ git clone -b tidy-html5-5.6 --recursive https://github.com/prantlf/node-libtidy

Cloning into 'node-libtidy'...
remote: Counting objects: 594, done.
remote: Total 594 (delta 0), reused 0 (delta 0), pack-reused 594
Receiving objects: 100% (594/594), 126.82 KiB | 234.00 KiB/s, done.
Resolving deltas: 100% (384/384), done.
Submodule 'tidy-html5' (https://github.com/htacg/tidy-html5.git) registered for path 'tidy-html5'
Cloning into '/tmp/test/node-libtidy/tidy-html5'...
remote: Counting objects: 8855, done.        
remote: Total 8855 (delta 0), reused 0 (delta 0), pack-reused 8855        
Receiving objects: 100% (8855/8855), 5.14 MiB | 340.00 KiB/s, done.
Resolving deltas: 100% (5544/5544), done.
Submodule path 'tidy-html5': checked out '3a30f6a4300417674026f6dddea5973debc6b808'

$ cd node-libtidy

Compiling the native module fails with "You must run node-gyp configure first!". Shouldn't node-pre-gyp take care of it?

$ npm i

> [email protected] install /tmp/test/node-libtidy
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/gagern/node-libtidy/releases/download/v0.3.8/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Tried to download(undefined): https://github.com/gagern/node-libtidy/releases/download/v0.3.8/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
gyp ERR! build error 
gyp ERR! stack Error: You must run `node-gyp configure` first!
gyp ERR! stack     at ReadFileContext.<anonymous> (/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:49:20)
gyp ERR! stack     at ReadFileContext.callback (/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
gyp ERR! stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:242:13)
gyp ERR! System Linux 4.15.0-24-generic
gyp ERR! command "/home/ferdipr/.nvm/versions/node/v10.6.0/bin/node" "/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/test/node-libtidy/lib/tidy.node" "--module_name=tidy" "--module_path=/tmp/test/node-libtidy/lib"
gyp ERR! cwd /tmp/test/node-libtidy
gyp ERR! node -v v10.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/ferdipr/.nvm/versions/node/v10.6.0/bin/node /home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/test/node-libtidy/lib/tidy.node --module_name=tidy --module_path=/tmp/test/node-libtidy/lib' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/test/node-libtidy/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Linux 4.15.0-24-generic
node-pre-gyp ERR! command "/home/ferdipr/.nvm/versions/node/v10.6.0/bin/node" "/tmp/test/node-libtidy/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/test/node-libtidy
node-pre-gyp ERR! node -v v10.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/home/ferdipr/.nvm/versions/node/v10.6.0/bin/node /home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/test/node-libtidy/lib/tidy.node --module_name=tidy --module_path=/tmp/test/node-libtidy/lib' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/ferdipr/.npm/_logs/2018-07-21T08_03_23_059Z-debug.log

Running node-pre-gyp rebuild succeeds both configuring and compiling the native module:

$ ./node_modules/.bin/node-pre-gyp rebuild

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
[libtidy] Removing "/tmp/test/node-libtidy/lib"
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/test/node-libtidy/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ferdipr/.node-gyp/10.6.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/ferdipr/.node-gyp/10.6.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/ferdipr/.nvm/versions/node/v10.6.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/ferdipr/.node-gyp/10.6.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/test/node-libtidy',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmp/test/node-libtidy/build'
  CXX(target) Release/obj.target/tidy/src/node-libtidy.o
In file included from ../src/node-libtidy.hh:6:0,
                 from ../src/node-libtidy.cc:1:
../tidy-html5/include/tidy.h:2095:13: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
 TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangWindowsName( const tidyLocaleMapItem *item );
             ^~~~~
../tidy-html5/include/tidy.h:2101:13: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
 TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangPosixName( const tidyLocaleMapItem *item );
             ^~~~~
 ... lots ow warnings snipped from here...
 
  CC(target) Release/obj.target/tidy/tidy-html5/src/sprtf.o
  SOLINK_MODULE(target) Release/obj.target/tidy.node
  COPY Release/tidy.node
  COPY /tmp/test/node-libtidy/lib/tidy.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/tmp/test/node-libtidy/build'
gyp info ok 
node-pre-gyp info ok 

Repeating the module installation finds the compiled native library and succeeds too:

$ npm i

> [email protected] install /tmp/test/node-libtidy
> node-pre-gyp install --fallback-to-build

[libtidy] Success: "/tmp/test/node-libtidy/lib/tidy.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> [email protected] prepublish /tmp/test/node-libtidy
> node util/gen-typescript-decl.js

successfully generated /tmp/test/node-libtidy/src/options.d.ts
up to date in 0.932s

Tests pass:

$ npm test

> [email protected] pretest /tmp/test/node-libtidy
> node util/gen-typescript-decl.js

successfully generated /tmp/test/node-libtidy/src/options.d.ts

> [email protected] test /tmp/test/node-libtidy
> mocha --compilers ts:ts-node/register

(node:22454) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

  TidyDoc:
    construction:
      ✓ as constructor
      ✓ as function
    basic synchroneous operation:
      ✓ parse buffer
      ✓ clean and repair
      ✓ diagnostics
      ✓ save to buffer
      ✓ report errors in diagnostics
      ✓ will not produce output in case of an error
      ✓ can produce output despite errors
    basic asynchroneous operation using callback:
      ✓ parse buffer
      ✓ clean and repair
      ✓ diagnostics
      ✓ save to buffer
      ✓ will not produce output in case of an error
      ✓ all in one go
    basic asynchroneous operation using promise:
      ✓ parse buffer
      ✓ clean and repair
      ✓ diagnostics
      ✓ save to buffer
      ✓ will not produce output in case of an error
      ✓ all in one go

  High-level API:
    tidyBuffer:
      ✓ on simple document
      ✓ doesn't use CRLF in its output
      ✓ Converts argument to buffer

  htmltidy interface:
    tidy function:
      ✓ Handles a simple document the same way

  TidyOption:
    naming:
      ✓ with hyphens
      ✓ with underscores
      ✓ with camelCase
      ✓ mixed
    getting and setting values:
      ✓ setting should affect the value
      ✓ null or undefined clear string settings
      ✓ objects get stringified
      ✓ invalid keys throw
      ✓ can handle boolean options
      ✓ setting a readonly option throws
      ✓ can handle integer options
      ✓ can handle the char-encoding option
      ✓ can handle the newline option
      ✓ can handle AutoBool options
      ✓ can find current value from enum
      ✓ only affect one document
    Documentation for options:
      ✓ optGetDoc
      ✓ optGetDocLinksList
    dealing with TidyOption objects:
      ✓ lookup by name
      ✓ accessors
      ✓ lookup by id
      ✓ for getting
      ✓ for setting
      ✓ listing options
    the options object:
      ✓ listing options
      ✓ complete list
      ✓ can be used for getting
      ✓ can be used for setting
      ✓ can be assigned to for configuration

  index.d.ts
    ✓ has sync tidy API
    ✓ has async tidy API
    ✓ has option set / get API

  57 passing (64ms)

My environment:

$ uname -a
Linux de08365 4.15.0-24-generic #26-Ubuntu SMP Wed Jun 13 08:44:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic

$ node -v
v10.6.0

$ npm -v
6.1.0

@prantlf prantlf closed this Jul 21, 2018
@prantlf
Copy link
Author

prantlf commented Jul 21, 2018

Accidentally closed when commenting, sorry.

@prantlf prantlf reopened this Jul 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants