SkyAPM/SkyAPM-nodejs

Version 2.0.0

wandersonwhcr opened this issue · 4 comments

Hello,

The documentation says Skywalking 8.0.0 needs skyapm-nodejs 2.0.0, but this version doesn't exist on NPM.

So, I am trying to build from source using docker node image:

docker run --rm --interactive --tty \
  --user `id -u`:`id -g` \
  --volume `pwd`:/app \
  --workdir `/app` \
  node npm install

I am receiving this error:

> skyapm-nodejs@2.0.0 generate-source:darwin:linux /app
> rm -rf lib/network && mkdir -p lib/network && cd proto && grpc_tools_node_protoc --js_out=import_style=commonjs,binary:../lib/network/ --grpc_out=../lib/network/ common/*.proto language-agent/Tracing.proto management/*.proto

common/*.proto: No such file or directory
/app/node_modules/grpc-tools/bin/protoc.js:41
    throw error;
    ^

Error: Command failed: /app/node_modules/grpc-tools/bin/protoc --plugin=protoc-gen-grpc=/app/node_modules/grpc-tools/bin/grpc_node_plugin --js_out=import_style=commonjs,binary:../lib/network/ --grpc_out=../lib/network/ common/*.proto language-agent/Tracing.proto management/*.proto
common/*.proto: No such file or directory

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1051:16)
    at Socket.<anonymous> (internal/child_process.js:442:11)
    at Socket.emit (events.js:314:20)
    at Pipe.<anonymous> (net.js:673:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: '/app/node_modules/grpc-tools/bin/protoc --plugin=protoc-gen-grpc=/app/node_modules/grpc-tools/bin/grpc_node_plugin --js_out=import_style=commonjs,binary:../lib/network/ --grpc_out=../lib/network/ common/*.proto language-agent/Tracing.proto management/*.proto'
}

I removed the scripts generate-source:win32 and generate-source:darwin:linux and it installed successfully.

But when I start an application, I receive this error.


> wandersonwhcr@1.0.1-alpha start /app
> node server.js

internal/modules/cjs/loader.js:1033
  throw err;
  ^

Error: Cannot find module '../network/common/Common_pb'
Require stack:
- /app/nodejs-agent/lib/trace/span.js
- /app/nodejs-agent/lib/trace/trace-context.js
- /app/nodejs-agent/lib/trace/context-manager.js
- /app/nodejs-agent/lib/agent.js
- /app/nodejs-agent/index.js
- /app/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.Module._load (internal/modules/cjs/loader.js:899:27)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/app/nodejs-agent/lib/trace/span.js:24:27)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/nodejs-agent/lib/trace/span.js',
    '/app/nodejs-agent/lib/trace/trace-context.js',
    '/app/nodejs-agent/lib/trace/context-manager.js',
    '/app/nodejs-agent/lib/agent.js',
    '/app/nodejs-agent/index.js',
    '/app/server.js'
  ]
}

Directory ./nodejs-agent/lib/network is empty.

Do not remove anything, and please clone the submodules(git submodule update --init) before running npm command

The problem is I am using node:14-alpine image.

I will change to node:14.

TY.

grpc/grpc-node#744 (comment)