yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

node-gyp build of leveldown failed on yarn, works on npm #2496

Open kenrick95 opened 7 years ago

kenrick95 commented 7 years ago

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 test5@1.0.0 No description
npm WARN package.json test5@1.0.0 No README data
/
> leveldown@1.5.0 install D:\Cloud\GitHub\test5\node_modules\pouchdb\node_modules\leveldown
> prebuild --install

pouchdb@6.1.1 node_modules\pouchdb
├── clone-buffer@1.0.0
├── inherits@2.0.3
├── scope-eval@0.0.3
├── ltgt@2.1.2
├── spark-md5@3.0.0
├── vuvuzela@1.0.3
├── double-ended-queue@2.1.0-0
├── immediate@3.0.6
├── argsarray@0.0.1
├── lie@3.1.0
├── level-codec@6.2.0
├── debug@2.6.0 (ms@0.7.2)
├── readable-stream@1.0.33 (string_decoder@0.10.31, isarray@0.0.1, core-util-is@1.0.2)
├── through2@2.0.1 (xtend@4.0.1, readable-stream@2.0.6)
├── level-write-stream@1.0.0 (end-stream@0.1.0)
├── buffer-from@0.1.1 (is-array-buffer-x@1.0.13)
├── levelup@1.3.3 (xtend@4.0.1, prr@1.0.1, level-iterator-stream@1.3.1, level-codec@6.1.0, semver@5.1.1, deferred-leveldown@1.2.1, level-errors@1.0.4)
├── request@2.79.0 (tunnel-agent@0.4.3, oauth-sign@0.8.2, aws-sign2@0.6.0, forever-agent@0.6.1, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, aws4@1.5.0, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, uuid@3.0.1, qs@6.3.0, combined-stream@1.0.5, form-data@2.1.2, tough-cookie@2.3.2, mime-types@2.1.14, hawk@3.1.3, har-validator@2.0.6, http-signature@1.1.1)
└── leveldown@1.5.0 (bindings@1.2.1, fast-future@1.0.2, abstract-leveldown@2.6.1, nan@2.4.0, prebuild@4.5.0)

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

Additional note:

amb26 commented 7 years ago

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

thegreatsunra commented 7 years ago

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

zcong1993 commented 7 years ago

Same issue for me

thegreatsunra commented 7 years ago

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

zamb3zi commented 7 years ago

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

unisys12 commented 7 years ago

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](PouchDB Custom Page) and eliminate all the hassles and frustrations above.

alexissantos commented 7 years ago

Also happening for me on:

nerumo commented 7 years ago

the same on windows with yarn 0.28.5 on and node 8.4.0

IAMtheIAM commented 7 years ago

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

amb26 commented 7 years ago

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

IAMtheIAM commented 7 years ago

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.

cedricdelpoux commented 7 years ago

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

rdewolff commented 6 years ago

Still having this issue with yarn

AlBannaTechno commented 6 years ago

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

yuminatwca commented 5 years ago

NPM works, yarn doesnt!!!

rdewolff commented 5 years ago

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 👎

md8n commented 5 years ago

... 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
rdewolff commented 5 years ago

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