Describe the bug
An error is raised during the yarn bootstrap execution, from a clean repository clone.
To Reproduce
Steps to reproduce the behavior:
yarn bootstrap command from the root folder.[5/5] 馃敤 Building fresh packages...
error /Users/user/Projects/storybook/node_modules/weak: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/user/Projects/storybook/node_modules/weak
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args '/Users/user/Projects/storybook/node_modules/npm-lifecycle/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 '/Users/user/Projects/storybook/node_modules/weak/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/user/Projects/storybook/node_modules/npm-lifecycle/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/user/.node-gyp/12.9.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/user/.node-gyp/12.9.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/user/Projects/storybook/node_modules/npm-lifecycle/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/user/.node-gyp/12.9.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/user/Projects/storybook/node_modules/weak',
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' ]
CXX(target) Release/obj.target/weakref/src/weakref.o
../src/weakref.cc:147:25: error: too few arguments to function call, expected 4, have 3; did you mean 'Nan::Call'?
globalCallbackDirect->Call(Nan::GetCurrentContext()->Global(), 1, argv);
^~~~
Nan::Call
../../nan/nan_maybe_43_inl.h:345:30: note: 'Nan::Call' declared here
inline MaybeLocal<v8::Value> Call(
^
../src/weakref.cc:168:75: error: too few arguments to function call, single argument 'context' was not specified
Local<Object> proxy = Nan::New<ObjectTemplate>(proxyClass)->NewInstance();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/user/.node-gyp/12.9.1/include/node/v8.h:6258:3: note: 'NewInstance' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
^
/Users/user/.node-gyp/12.9.1/include/node/v8config.h:351:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/weakref.cc:223:55: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
Local<Boolean> rtn = Nan::New<Boolean>(cont->target.IsNearDeath());
~~~~~~~~~~~~ ^
3 errors generated.
make: *** [Release/obj.target/weakref/src/weakref.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/user/Projects/storybook/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:209:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/12.9.1/bin/node" "/Users/user/Projects/storybook/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/user/Projects/storybook/node_modules/weak
gyp ERR! node -v v12.9.1
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
The expected behavior is to clone and bootstrap the project without this workaround: comment weak module in the package.json file.
Screenshots
/
Code snippets
/
System:
Environment Info:
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
Binaries:
Node: 12.9.1 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
Browsers:
Chrome: 76.0.3809.132
Safari: 12.1.2
npmGlobalPackages:
@storybook/cli: 5.2.0-rc.6
Additional context
The issue is reproducible on multiple MacOS environments and on different machines in our workspace.
@darondel this is due to node 12 - i downgraded to lts node 10 and then it worked fine.
@atanasster Yeah, this is what I thought. This has been issued here, but there's no update for a while on the weak repository.
I discussed with @ndelangen on this and we agree to remove this dep as a quick fix. Moreover, it looks like the next major release of Jest will certainly fix the issue @ndelangen face when weak is not listed as a dependency.
More context about this in my PR https://github.com/storybookjs/storybook/pull/8300.
Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.11 containing PR #8300 that references this issue. Upgrade today to try it out!
You can find this prerelease on the @next NPM tag.
Closing this issue. Please re-open if you think there's still more to do.
Most helpful comment
@darondel this is due to node 12 - i downgraded to lts node 10 and then it worked fine.