Node 10 problem with yarn workspaces and lerna monorepo
fernandopasik opened this issue ยท 4 comments
When adding the dependency in one of the packages inside the monorepo I get a big error log from node-gyp.
~/Sites/myproject/packages/subpackage$ yarn add gc-stats
yarn add v1.10.1
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
[3/4] ๐ Linking dependencies...
[4/4] ๐ Building fresh packages...
[-/4] โก waiting...
[2/4] โก gc-stats
[-/4] โก waiting...
error /Users/myuser/Sites/myproject/node_modules/gc-stats: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/myuser/Sites/myproject/node_modules/gc-stats
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.10.3
node-pre-gyp info using node@10.11.0 | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node" (not found)
node-pre-gyp http GET https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp http 403 https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(403): https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for gc-stats@1.2.0 and node@10.11.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for gc-stats@1.2.0 and node@10.11.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info ok
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/myuser/Sites/myproject/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/myuser/Sites/myproject/node_modules/gc-stats/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myuser/Sites/myproject/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myuser/.node-gyp/10.11.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=/Users/myuser/.node-gyp/10.11.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/myuser/Sites/myproject/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/myuser/.node-gyp/10.11.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/myuser/Sites/myproject/node_modules/gc-stats',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp infogyp spawn args '--no-parallel',
gyp infoinfo spawn args '--generator-output',
spawngyp /usr/bin/python
info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn args [ '/Users/myuser/Sites/myproject/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/myuser/Sites/myproject/node_modules/gc-stats/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myuser/Sites/myproject/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myuser/.node-gyp/10.11.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=/Users/myuser/.node-gyp/10.11.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/myuser/Sites/myproject/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/myuser/.node-gyp/10.11.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/myuser/Sites/myproject/node_modules/gc-stats',
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=.' ]
gypgyp info info okok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/gcstats/src/gcstats.o
CXX(target) Release/obj.target/gcstats/src/gcstats.o
rm: ./Release/.deps/Release/obj.target/gcstats/src/gcstats.o.d.raw: No such file or directory
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/myuser/Sites/myproject/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
SOLINK_MODULE(target) Release/gcstats.node
gyp ERR! command "/Users/myuser/.nvm/versions/node/v10.11.0/bin/node" "/Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node" "--module_name=gcstats" "--module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/myuser/Sites/myproject/node_modules/gc-stats
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/myuser/.nvm/versions/node/v10.11.0/bin/node /Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/myuser/Sites/myproject/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/myuser/.nvm/versions/node/v10.11.0/bin/node" "/Users/myuser/Sites/myproject/node_modules/gc-stats/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/myuser/Sites/myproject/node_modules/gc-stats
node-pre-gyp ERR! node -v v10.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/Users/myuser/.nvm/versions/node/v10.11.0/bin/node /Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
COPY /Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node
I can't reproduce
It looks like it is your environment specific issue(node-gyp build fails)
You are right, just adding the dependency in a subpackage doesn't throw errors. I manage to reproduce it adding a dependency in the root package.json that triggers also node-gyp
. The package I used is jest which is pretty standard nowadays in a project.
so the files to reproduce it:
package.json
{
"name": "test",
"version": "1.0.0",
"private": true,
"license": "MIT",
"workspaces": [
"packages/*"
],
"devDependencies": {
"jest": "^23.6.0"
}
}
packages/subpackage/package.json
{
"name": "subpackage",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"gc-stats": "^1.2.0"
}
}
Just do yarn install
and you'll see that error I posted previously.
@dainis did you have the chance to try this again?
I've forced your package to use node-pre-gyp@0.11.0
with yarn resolutions and it doesn't present errors any more, could you please update that in your package?