atom/electron-link

leveldown@^1.6.0 dependency breaks builds on Node.js v10.0.0

Closed this issue ยท 7 comments

The current version of leveldown (v3.0.0) builds on Node.js perfectly fine, however the old ^1.6.0 dependency specified here breaks the build of Atom.

Versions:
Attempting to build atom/atom@59cb1dd.

Node.js: v10.0.0
npm: v6.0.0
OS: Windows 10 x64


Checking the npm debug log shows this message:

32386 silly install leveldown@1.9.0
32387 info lifecycle leveldown@1.9.0~install: leveldown@1.9.0
32388 verbose lifecycle leveldown@1.9.0~install: unsafe-perm in lifecycle true
32389 verbose lifecycle leveldown@1.9.0~install: PATH: C:\Users\abneyl\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\temp\atom\script\node_modules\leveldown\node_modules\.bin;C:\temp\atom\script\node_modules\.bin;C:\Python27;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Program Files\Haskell\bin;C:\Program Files\Haskell Platform\7.10.2-a\lib\extralibs\bin;C:\Program Files\Haskell Platform\7.10.2-a\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files\PuTTY\;C:\Program Files\Haskell Platform\7.10.2-a\mingw\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files (x86)\GnuPG\bin;C:\Ruby24-x64\bin;C:\php7;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\dotnet\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\LLVM\bin;C:\Users\abneyl\AppData\Local\Microsoft\WindowsApps;C:\Users\abneyl\AppData\Local\atom\bin;C:\Users\abneyl\AppData\Local\ComposerSetup\bin;C:\Users\abneyl\AppData\Roaming\Composer\vendor\bin;C:\Users\abneyl\bin;C:\Users\abneyl\AppData\Local\Microsoft\WindowsApps;C:\Users\abneyl\AppData\Roaming\npm;C:\Users\abneyl\AppData\Local\GitHubDesktop\bin
32390 verbose lifecycle leveldown@1.9.0~install: CWD: C:\temp\atom\script\node_modules\leveldown
32391 silly lifecycle leveldown@1.9.0~install: Args: [ '/d /s /c', 'prebuild-install || node-gyp rebuild' ]
32392 silly lifecycle leveldown@1.9.0~install: Returned: code: 1  signal: null
32393 info lifecycle leveldown@1.9.0~install: Failed to exec install script

And attempting to install it individually on a blank project leads to this message:

c:\temp\foo\node_modules\nan\nan_maybe_43_inl.h(112): error C2039: 'ForceSet': is not a member of 'v8::Object' (compiling source file ..\src\batch.cc) [C:\temp\foo\node_modules\leveldown\build\leveldown.vcxproj]
  c:\users\abneyl\.node-gyp\10.0.0\include\node\v8.h(3111): note: see declaration of 'v8::Object' (compiling source file ..\src\batch.cc)
For reference, here is the completely useless error printed when running script\build.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\abneyl\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\abneyl\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\temp\atom\script\node_modules\leveldown
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! leveldown@1.9.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the leveldown@1.9.0 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!     C:\Users\abneyl\AppData\Roaming\npm-cache\_logs\2018-04-26T19_05_31_529Z-debug.log
child_process.js:617
    throw err;
    ^

Error: Command failed: npm.cmd --loglevel=error install
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\abneyl\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\abneyl\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\temp\atom\script\node_modules\leveldown
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! leveldown@1.9.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the leveldown@1.9.0 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!     C:\Users\abneyl\AppData\Roaming\npm-cache\_logs\2018-04-26T19_05_31_529Z-debug.log

    at checkExecSyncError (child_process.js:596:11)
    at Object.execFileSync (child_process.js:614:13)
    at module.exports (C:\temp\atom\script\lib\install-script-dependencies.js:9:16)
    at Object.<anonymous> (C:\temp\atom\script\bootstrap:28:1)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)

Hmmm, I can't actually find where leveldown is being used here. Somebody who knows this package better will have to determine if it's actually being used, or just an artifact from the command in the recommended usage section of the levelup readme.

I've also been unable to build because of the leveldown 1.9.0 error, and I assume it's a dependency in one of the other modules. That said, which one? Since I can't build anymore, I spend that same time looking for the elusive leveldown@1.9.0, so far without success.

Also hitting this, @Arcanemagus did you find a workaround ?

I tried reverting to Node v9, which was recommended in one of the posts I read. The whole thing appears to build just fine, but in that environment, fails for lack of "dump_syms."

@capouch it's a direct dependency here.

@neok-m4700 the only workaround that I know of is to use Node.js v9 to build Atom. (which does work @capouch.)

As i said in the issue I can't see where leveldown is actually used in this code base, and I'm guessing it's a leftover from the installation instructions listed in the readme for levelup.

After removing the leveldown dependency, build completes fine. However, 5 tests that indirectly depend on leveldown break.


> electron-link@0.2.0 test /home/karthanis/Documents/atom/electron-link/git-fork
> mocha test/**/*.test.js --ui=tdd --compilers js:babel-register "2"



  FileRequireTransform
    โœ“ simple require
    โœ“ conditional requires
    โœ“ top-level variables assignments that depend on previous requires
    โœ“ top-level usage of deferred modules
    โœ“ requires that appear in a closure wrapper defined in the top-level scope (e.g. CoffeeScript)
    โœ“ references to shadowed variables
    โœ“ references to globals
    โœ“ multiple assignments separated by commas referencing deferred modules
    โœ“ require with destructuring assignment
    โœ“ JSON source
    โœ“ path resolution

  generateSnapshotScript({baseDirPath, mainPath})
    1) simple integration test
    2) cyclic requires
    3) auxiliary data
    4) process.platform
    5) row translation


  11 passing (171ms)
  5 failing

  1) generateSnapshotScript({baseDirPath, mainPath}) simple integration test:
     LevelUPError: Failed to require LevelDOWN (Cannot find module 'leveldown/package.json'). Try `npm install leveldown` if it's missing
      at requireError (node_modules/levelup/lib/leveldown.js:37:10)
      at getLevelDOWN (node_modules/levelup/lib/leveldown.js:14:11)
      at LevelUP.open (node_modules/levelup/lib/levelup.js:112:34)
      at new LevelUP (node_modules/levelup/lib/levelup.js:84:8)
      at LevelUP (node_modules/levelup/lib/levelup.js:45:44)
      at Promise (src/transform-cache.js:65:7)
      at new Promise (<anonymous>)
      at TransformCache._initialize (src/transform-cache.js:64:12)
      at src/transform-cache.js:13:16
      at Generator.next (<anonymous>)
      at step (src/transform-cache.js:1:191)
      at src/transform-cache.js:1:437
      at new Promise (<anonymous>)
      at src/transform-cache.js:1:99
      at TransformCache.loadOrCreate (src/transform-cache.js:12:25)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:29:19)
      at Generator.next (<anonymous>)
      at step (test/unit/generate-snapshot-script.test.js:1:191)
      at test/unit/generate-snapshot-script.test.js:1:437
      at new Promise (<anonymous>)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:1:99)

  2) generateSnapshotScript({baseDirPath, mainPath}) cyclic requires:
     LevelUPError: Failed to require LevelDOWN (Cannot find module 'leveldown/package.json'). Try `npm install leveldown` if it's missing
      at requireError (node_modules/levelup/lib/leveldown.js:37:10)
      at getLevelDOWN (node_modules/levelup/lib/leveldown.js:14:11)
      at LevelUP.open (node_modules/levelup/lib/levelup.js:112:34)
      at new LevelUP (node_modules/levelup/lib/levelup.js:84:8)
      at LevelUP (node_modules/levelup/lib/levelup.js:45:44)
      at Promise (src/transform-cache.js:65:7)
      at new Promise (<anonymous>)
      at TransformCache._initialize (src/transform-cache.js:64:12)
      at src/transform-cache.js:13:16
      at Generator.next (<anonymous>)
      at step (src/transform-cache.js:1:191)
      at src/transform-cache.js:1:437
      at new Promise (<anonymous>)
      at src/transform-cache.js:1:99
      at TransformCache.loadOrCreate (src/transform-cache.js:12:25)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:124:19)
      at Generator.next (<anonymous>)
      at step (test/unit/generate-snapshot-script.test.js:1:191)
      at test/unit/generate-snapshot-script.test.js:1:437
      at new Promise (<anonymous>)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:1:99)

  3) generateSnapshotScript({baseDirPath, mainPath}) auxiliary data:
     LevelUPError: Failed to require LevelDOWN (Cannot find module 'leveldown/package.json'). Try `npm install leveldown` if it's missing
      at requireError (node_modules/levelup/lib/leveldown.js:37:10)
      at getLevelDOWN (node_modules/levelup/lib/leveldown.js:14:11)
      at LevelUP.open (node_modules/levelup/lib/levelup.js:112:34)
      at new LevelUP (node_modules/levelup/lib/levelup.js:84:8)
      at LevelUP (node_modules/levelup/lib/levelup.js:45:44)
      at Promise (src/transform-cache.js:65:7)
      at new Promise (<anonymous>)
      at TransformCache._initialize (src/transform-cache.js:64:12)
      at src/transform-cache.js:13:16
      at Generator.next (<anonymous>)
      at step (src/transform-cache.js:1:191)
      at src/transform-cache.js:1:437
      at new Promise (<anonymous>)
      at src/transform-cache.js:1:99
      at TransformCache.loadOrCreate (src/transform-cache.js:12:25)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:167:17)
      at Generator.next (<anonymous>)
      at step (test/unit/generate-snapshot-script.test.js:1:191)
      at test/unit/generate-snapshot-script.test.js:1:437
      at new Promise (<anonymous>)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:1:99)

  4) generateSnapshotScript({baseDirPath, mainPath}) process.platform:
     LevelUPError: Failed to require LevelDOWN (Cannot find module 'leveldown/package.json'). Try `npm install leveldown` if it's missing
      at requireError (node_modules/levelup/lib/leveldown.js:37:10)
      at getLevelDOWN (node_modules/levelup/lib/leveldown.js:14:11)
      at LevelUP.open (node_modules/levelup/lib/levelup.js:112:34)
      at new LevelUP (node_modules/levelup/lib/levelup.js:84:8)
      at LevelUP (node_modules/levelup/lib/levelup.js:45:44)
      at Promise (src/transform-cache.js:65:7)
      at new Promise (<anonymous>)
      at TransformCache._initialize (src/transform-cache.js:64:12)
      at src/transform-cache.js:13:16
      at Generator.next (<anonymous>)
      at step (src/transform-cache.js:1:191)
      at src/transform-cache.js:1:437
      at new Promise (<anonymous>)
      at src/transform-cache.js:1:99
      at TransformCache.loadOrCreate (src/transform-cache.js:12:25)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:195:17)
      at Generator.next (<anonymous>)
      at step (test/unit/generate-snapshot-script.test.js:1:191)
      at test/unit/generate-snapshot-script.test.js:1:437
      at new Promise (<anonymous>)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:1:99)

  5) generateSnapshotScript({baseDirPath, mainPath}) row translation:
     LevelUPError: Failed to require LevelDOWN (Cannot find module 'leveldown/package.json'). Try `npm install leveldown` if it's missing
      at requireError (node_modules/levelup/lib/leveldown.js:37:10)
      at getLevelDOWN (node_modules/levelup/lib/leveldown.js:14:11)
      at LevelUP.open (node_modules/levelup/lib/levelup.js:112:34)
      at new LevelUP (node_modules/levelup/lib/levelup.js:84:8)
      at LevelUP (node_modules/levelup/lib/levelup.js:45:44)
      at Promise (src/transform-cache.js:65:7)
      at new Promise (<anonymous>)
      at TransformCache._initialize (src/transform-cache.js:64:12)
      at src/transform-cache.js:13:16
      at Generator.next (<anonymous>)
      at step (src/transform-cache.js:1:191)
      at src/transform-cache.js:1:437
      at new Promise (<anonymous>)
      at src/transform-cache.js:1:99
      at TransformCache.loadOrCreate (src/transform-cache.js:12:25)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:211:17)
      at Generator.next (<anonymous>)
      at step (test/unit/generate-snapshot-script.test.js:1:191)
      at test/unit/generate-snapshot-script.test.js:1:437
      at new Promise (<anonymous>)
      at Context.<anonymous> (test/unit/generate-snapshot-script.test.js:1:99)

Fixed by #12 thanks to @karthanistyr, shipped v0.2.2 with the change.