brrd / abricotine

Markdown editor with inline preview
GNU General Public License v3.0
2.63k stars 159 forks source link

Unable to install dependencies with Node 12 #261

Closed lorefnon closed 5 years ago

lorefnon commented 5 years ago

I believe this is related to https://github.com/atom/node-spellchecker/issues/119

ubuntu :: ~/projects/Abricotine ‹develop› » yarn 
yarn install v1.7.0
info No lockfile found.
[1/4] Resolving packages...
⠁ (node:6461) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning electron > electron-download > nugget > progress-stream > through2 > xtend > object-keys@0.4.0: 
warning request > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning request > hawk > sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning request > hawk > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning request > hawk > sntp > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning request > hawk > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning request > hawk > boom > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning request > hawk > cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning request > hawk > cryptiles > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /host/Users/loref/Projects/Abricotine/node_modules/spellchecker: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /host/Users/loref/Projects/Abricotine/node_modules/spellchecker
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@12.3.0 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/home/lorefnon/.nvm/versions/node/v12.3.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   '/host/Users/loref/Projects/Abricotine/node_modules/spellchecker/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/lorefnon/.nvm/versions/node/v12.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/lorefnon/.node-gyp/12.3.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/lorefnon/.node-gyp/12.3.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/lorefnon/.nvm/versions/node/v12.3.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/lorefnon/.node-gyp/12.3.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/host/Users/loref/Projects/Abricotine/node_modules/spellchecker',
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 spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/host/Users/loref/Projects/Abricotine/node_modules/spellchecker/build'
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affentry.o
In file included from ../vendor/hunspell/src/hunspell/affentry.cxx:9:0:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: converting to non-pointer type ‘short unsigned int’ from NULL [-Wconversion-null]
   struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                         ^~~~
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: converting to non-pointer type ‘short unsigned int’ from NULL [-Wconversion-null]
   struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                                  ^~~~
../vendor/hunspell/src/hunspell/affentry.cxx: In member function ‘int PfxEntry::test_condition(const char*)’:
../vendor/hunspell/src/hunspell/affentry.cxx:113:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
          case '.': if (!pos) { // dots are not metacharacters in groups: [.]
                    ^~
../vendor/hunspell/src/hunspell/affentry.cxx:120:5: note: here
     default: {
     ^~~~~~~
../vendor/hunspell/src/hunspell/affentry.cxx: In member function ‘int SfxEntry::test_condition(const char*, const char*)’:
../vendor/hunspell/src/hunspell/affentry.cxx:501:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case '.': if (!pos) { // dots are not metacharacters in groups: [.]
                   ^~
../vendor/hunspell/src/hunspell/affentry.cxx:516:5: note: here
     default: {
     ^~~~~~~
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affixmgr.o
In file included from ../vendor/hunspell/src/hunspell/affixmgr.cxx:12:0:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: converting to non-pointer type ‘short unsigned int’ from NULL [-Wconversion-null]
   struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                         ^~~~
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: converting to non-pointer type ‘short unsigned int’ from NULL [-Wconversion-null]
   struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                                  ^~~~
../vendor/hunspell/src/hunspell/affixmgr.cxx: In member function ‘int AffixMgr::parse_convtable(char*, FileMgr*, RepList**, const char*)’:
../vendor/hunspell/src/hunspell/affixmgr.cxx:3654:64: warning: argument to ‘sizeof’ in ‘int strncmp(const char*, const char*, size_t)’ call is the same expression as the second source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
                              if (strncmp(piece, keyword, sizeof(keyword)) != 0) {
                                                                ^
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/csutil.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/dictmgr.o
../vendor/hunspell/src/hunspell/dictmgr.cxx: In member function ‘int DictMgr::parse_file(const char*, const char*)’:
../vendor/hunspell/src/hunspell/dictmgr.cxx:102:37: warning: this statement may fall through [-Wimplicit-fallthrough=]
                        pdict->region=NULL;
                                     ^
../vendor/hunspell/src/hunspell/dictmgr.cxx:103:21: note: here
                     case 2: //deliberate fallthrough
                     ^~~~
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/filemgr.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hashmgr.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hunspell.o
../vendor/hunspell/src/hunspell/hunspell.cxx: In member function ‘int Hunspell::spell(const char*, int*, char**)’:
../vendor/hunspell/src/hunspell/hunspell.cxx:369:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
             *info += SPELL_ORIGCAP;
../vendor/hunspell/src/hunspell/hunspell.cxx:370:6: note: here
      case NOCAP: {
      ^~~~
../vendor/hunspell/src/hunspell/hunspell.cxx:439:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             }
             ^
../vendor/hunspell/src/hunspell/hunspell.cxx:441:6: note: here
      case INITCAP: {
      ^~~~
../vendor/hunspell/src/hunspell/hunspell.cxx: In member function ‘int Hunspell::suggest(char***, const char*)’:
../vendor/hunspell/src/hunspell/hunspell.cxx:741:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
                     capwords = 1;
                     ~~~~~~~~~^~~
../vendor/hunspell/src/hunspell/hunspell.cxx:742:6: note: here
      case HUHCAP: {
      ^~~~
../vendor/hunspell/src/hunspell/hunspell.cxx:865:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
               capwords = 1;
               ~~~~~~~~~^~~
../vendor/hunspell/src/hunspell/hunspell.cxx:866:11: note: here
           case HUHCAP: {
           ^~~~
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hunzip.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/phonet.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/replist.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/suggestmgr.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/parsers/textparser.o
  AR(target) Release/obj.target/hunspell.a
  COPY Release/hunspell.a
  CXX(target) Release/obj.target/spellchecker/src/main.o
In file included from ../../nan/nan.h:54:0,
                 from ../src/main.cc:3:
/home/lorefnon/.node-gyp/12.3.0/include/node/node.h:107:12: fatal error: util-inl.h: No such file or directory
 #  include <util-inl.h>
            ^~~~~~~~~~~~
compilation terminated.
spellchecker.target.mk:120: recipe for target 'Release/obj.target/spellchecker/src/main.o' failed
make: Leaving directory '/host/Users/loref/Projects/Abricotine/node_modules/spellchecker/build'
make: *** [Release/obj.target/spellchecker/src/main.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/lorefnon/.nvm/versions/node/v12.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.13.0-46-generic
gyp ERR! command "/home/lorefnon/.nvm/versions/node/v12.3.0/bin/node" "/home/lorefnon/.nvm/versions/node/v12.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /host/Users/loref/Projects/Abricotine/node_modules/spellchecker
gyp ERR! node -v v12.3.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

https://www.npmjs.com/package/hunspell-asm may be a viable alternative.

brrd commented 5 years ago

https://www.npmjs.com/package/hunspell-asm may be a viable alternative.

It would take time and efforts to move to an alternative. IMO the best thing to do is to wait for atom/node-spellchecker#119 to be fixed. Until then I'm afraid you will have to use a prior version of node to build Abricotine. Maybe nvm can be helpful for this.

let's keep your recommendation about hunspell-asm in mind anyway. It can be useful in the long term to avoid native modules.

Tokelin commented 2 years ago

Rather than opening a new issue related to spellchecker and node-gyp, I'll comment here, even though this one is closed.

I am trying to set up the development branch locally and so far have had no success either on Windows 10 or Ubuntu 20.04. The errors are related to node-gyp and spellchecker. Since I am currently on Ubuntu I will detail my attempts related to that.

I have tried 3 different node versions, using nvm, and all give me similar errors. Node versions I tried with are: v14.15.0 v15.14.0 v16.13.0 (LTS), all with the default npm versions that come when installing using nvm.

When attempting the install with v14 I get a huge error similar to the one in the issue. When using v15 and v16 though I get

npm ERR! path /home/tokelin/development/open-source/abricotine/node_modules/spellchecker
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | linux | x64
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack 
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:397:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Linux 5.11.0-38-generic
npm ERR! gyp ERR! command "/home/tokelin/.nvm/versions/node/v16.13.0/bin/node" "/home/tokelin/development/open-source/abricotine/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/tokelin/development/open-source/abricotine/node_modules/spellchecker
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

This makes me thing it's an error with Python on Ubuntu. python3 shows that I have 3.8.10 installed. I installed a package python-is-python3 which aliases python to python3, but the error tells me the package (node-gyp or spellchecker) is looking for python2. After removing the python-is-python3 package, so that python gives an error (as it should on Ubuntu 20.04) the npm error output changes to

npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

Which leads me to believe node-gyp (or spellchecker) needs python v2.X when calling python. I will install it and see if that fixes the error.

In any case... I would say replacing spellchecker as a dependency would be a good idea. I completely understand it won't be a simple undertaking, as a spellchecker is essential in any editing software and is probably used throughout the whole application.

Update: After installing Python 2.7.18 and aliasing it to python using python-is-python2 I still get a huge wall of text as an error.