Yarn: node-gyp build of leveldown failed on yarn, works on npm

Created on 19 Jan 2017  ยท  18Comments  ยท  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

bug

What is the current behavior?
Building "leveldown" failed on yarn

If the current behavior is a bug, please provide the steps to reproduce.

D:\Cloud\GitHub\test3>yarn add pouchdb
yarn add v0.19.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] โ  leveldown: ValueError: Variable expansion in this context permi
[-/1] โ  waiting...
[-/1] โ ‚ waiting...
[-/1] โ ‚ waiting...
error D:\Cloud\GitHub\test3\node_modules\leveldown: Command failed.
Exit code: 2
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c prebuild --install
Directory: D:\Cloud\GitHub\test3\node_modules\leveldown
Output:
prebuild info begin Prebuild version 4.5.0
prebuild http GET https://nodejs.org/download/release/v4.6.0/node-v4.6.0-headers.tar.gz
prebuild http 200 https://nodejs.org/download/release/v4.6.0/node-v4.6.0-headers.tar.gz
prebuild http GET https://nodejs.org/download/release/v4.6.0/SHASUMS256.txt
prebuild http GET https://nodejs.org/download/release/v4.6.0/win-x86/node.lib
prebuild http GET https://nodejs.org/download/release/v4.6.0/win-x64/node.lib
prebuild http 200 https://nodejs.org/download/release/v4.6.0/win-x86/node.lib
prebuild http 200 https://nodejs.org/download/release/v4.6.0/SHASUMS256.txt
prebuild http 200 https://nodejs.org/download/release/v4.6.0/win-x64/node.lib
prebuild info spawn C:\Python27\python.exe
prebuild info spawn args [ 'D:\\Cloud\\GitHub\\test3\\node_modules\\node-gyp\\gyp\\gyp_main.py',
prebuild info spawn args   'binding.gyp',
prebuild info spawn args   '-f',
prebuild info spawn args   'msvs',
prebuild info spawn args   '-G',
prebuild info spawn args   'msvs_version=auto',
prebuild info spawn args   '-I',
prebuild info spawn args   'D:\\Cloud\\GitHub\\test3\\node_modules\\leveldown\\build\\config.gypi',
prebuild info spawn args   '-I',
prebuild info spawn args   'D:\\Cloud\\GitHub\\test3\\node_modules\\node-gyp\\addon.gypi',
prebuild info spawn args   '-I',
prebuild info spawn args   'D:\\Cloud\\GitHub\\test3\\node_modules\\leveldown\\4.6.0\\include\\node\\common.gypi',
prebuild info spawn args   '-Dlibrary=shared_library',
prebuild info spawn args   '-Dvisibility=default',
prebuild info spawn args   '-Dnode_root_dir=D:\\Cloud\\GitHub\\test3\\node_modules\\leveldown\\4.6.0',
prebuild info spawn args   '-Dnode_gyp_dir=D:\\Cloud\\GitHub\\test3\\node_modules\\node-gyp',
prebuild info spawn args   '-Dnode_lib_file=node.lib',
prebuild info spawn args   '-Dmodule_root_dir=D:\\Cloud\\GitHub\\test3\\node_modules\\leveldown',
prebuild info spawn args   '--depth=.',
prebuild info spawn args   '--no-parallel',
prebuild info spawn args   '--generator-output',
prebuild info spawn args   'D:\\Cloud\\GitHub\\test3\\node_modules\\leveldown\\build',
prebuild info spawn args   '-Goutput_dir=.' ]
Traceback (most recent call last):
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 130, in Load
    params['parallel'], params['root_targets'])
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2778, in Load
    variables, includes, depth, check, True)
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 420, in LoadTargetBuildFile
    build_file_data, PHASE_EARLY, variables, build_file_path)
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1217, in ProcessVariablesAndConditionsInDict
    variables, build_file, 'variables')
  File "D:\Cloud\GitHub\test3\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1228, in ProcessVariablesAndConditionsInDict
    'only, found ' + expanded.__class__.__name__ + ' for ' + key)
ValueError: Variable expansion in this context permits str and int only, found long for lastUpdateCheck while trying to load binding.gyp
prebuild ERR! configure error
prebuild ERR! stack Error: `gyp` failed with exit code: 1
prebuild ERR! stack     at ChildProcess.onCpExit (D:\Cloud\GitHub\test3\node_modules\node-gyp\lib\configure.js:308:16)
prebuild ERR! stack     at emitTwo (events.js:87:13)
prebuild ERR! stack     at ChildProcess.emit (events.js:172:7)
prebuild ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
prebuild ERR! not ok
prebuild ERR! build Error: `gyp` failed with exit code: 1
prebuild ERR! build     at ChildProcess.onCpExit (D:\Cloud\GitHub\test3\node_modules\node-gyp\lib\configure.js:308:16)
prebuild ERR! build     at emitTwo (events.js:87:13)
prebuild ERR! build     at ChildProcess.emit (events.js:172:7)
prebuild ERR! build     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

What is the expected behavior?
npm's behaviour, that succeed on building

D:\Cloud\GitHub\test5>npm install --save pouchdb
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No README data
/
> [email protected] install D:\Cloud\GitHub\test5\node_modules\pouchdb\node_modules\leveldown
> prebuild --install

[email protected] node_modules\pouchdb
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected] ([email protected])
โ”œโ”€โ”€ [email protected] ([email protected], [email protected], [email protected])
โ”œโ”€โ”€ [email protected] ([email protected], [email protected])
โ”œโ”€โ”€ [email protected] ([email protected])
โ”œโ”€โ”€ [email protected] ([email protected])
โ”œโ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
โ”œโ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
โ””โ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])

Please mention your node.js, yarn and operating system version.

  • Node version 4.6.0 (x64)
  • npm version 2.15.9
  • Yarn version 0.19.1

- Windows 10 Anniversary Update (Version 10.0.14393), 64-bit

Additional note:

  • There is no error when calling yarn add leveldown
  • Node installation is managed by Nodist
  • Might be related to #1693 though that occurs on different package. So I'm opening a new issue.

Most helpful comment

I know this is a _yarnpkg_ issue tracker, but since this issue was posted based on the results from the cmd yarn install pouchdb and I found this conversation because of that _(having same issue)_, I thought I would share my two cents as well.

If you are like me and wanting to use PouchDB in the browser only and do not require a backend system, which is what Leveldown/LevelDB if for _(if I am not mistaken)_, you can install PouchDB for the browser only using yarn add pouchdb-browser https://pouchdb.com/custom.htmll and eliminate all the hassles and frustrations above.

All 18 comments

Same issue for me, node 6.9.2 x64, Windows 7 64-bit, Yarn 0.19.1, build works correctly with npm 3.10.8

I'm seeing the same issue on MacOS 10.12.3. npm install leveldown builds correctly but yarn add leveldown does not.

  • Node version 6.9.4
  • npm version 4.1.2
  • Yarn version 0.19.1
  • macOS 10.12.3 (16D32)

Same issue for me

  • Node version 7.5.0
  • npm versiion 4.1.2
  • Yarn version 0.20.3
  • Windows 10

With this combination, yarn add leveldown works for me now:

  • Node version 6.10.0
  • npm version 4.3.0
  • Yarn version 0.20.3
  • macOS 10.12.3

I can confirm this is now fixed for me on Windows 10 after upgrading to Yarn 0.20.3.

I know this is a _yarnpkg_ issue tracker, but since this issue was posted based on the results from the cmd yarn install pouchdb and I found this conversation because of that _(having same issue)_, I thought I would share my two cents as well.

If you are like me and wanting to use PouchDB in the browser only and do not require a backend system, which is what Leveldown/LevelDB if for _(if I am not mistaken)_, you can install PouchDB for the browser only using yarn add pouchdb-browser https://pouchdb.com/custom.htmll and eliminate all the hassles and frustrations above.

Also happening for me on:

  • Node v7.8.0
  • Yarn v0.27.5
  • NPM 5.1.0
  • Mac OS 10.12.3 (16D32)

the same on windows with yarn 0.28.5 on and node 8.4.0

Still happens for me. So what do we do?
yarn v0.27.5
node 6.10.0
Windows 10

What we do is continue using npm 3.x for all serious work, "Because newer isn't always better".

yea I agree, I'm going back to using NPM. its not worth trying to wade through all these random errors just to save a few seconds on initial installation with yarn, it costs more time hunting down solutions than just using NPM install.

Any news about this ? I still get this error with yarn

Still having this issue with yarn

Still having this issue
yarn : 1.10.1
node : 8.12.0
OS : windows 10 Enterprise 64-bit (10.0, Build 17713)

NPM works, yarn doesnt!!!

Current solution is to clear the cache with :

yarn cache clean

and remove node_modules folder with :

rm -rf node_modules

Then run yarn again.

And sometimes a computer restart before running the last step is required ๐Ÿ‘Ž

... and for those playing on Windows, rdewolff's solution can be used by changing this line:

rm -rf node_modules

with

rmdir /S /Q node_modules

I just had this issue on a brand new computer, after cloning a project and running yarn.

Was this page helpful?
0 / 5 - 0 ratings