我在安装chartjs-node时遇到错误。谢谢!我已经尝试过sudo npm install了。仍然会出现错误。无法解决我们的问题。有什么办法可以解决此问题?
sudo yarn add chartjs-node
yarn add v1.7.0
warning ../../package.json: No license field
[1/4] Resolving packages...
⠁ (node:22764) [DEP0005] DeprecationWarning: Buffer() is deprecated due to securityand usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > react-sparklines@1.7.0" has unmet peer dependency "react@*".
warning " > react-sparklines@1.7.0" has unmet peer dependency "react-dom@*".
warning " > chartjs-node@1.7.1" has unmetpeer dependency "chart.js@<=2.7.*".
[4/4] Building fresh packages...
[-/3] ⠄ waiting...
[-/3] ⠄ waiting...
error /home/yenneti/cryptochar/node/node_modules/canvas: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/yenneti/cryptochar/node/node_modules/canvas
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.4.1 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/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 '/home/yenneti/cryptochar/node/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/yenneti/.node-gyp/10.4.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=/home/yenneti/.node-gyp/10.4.1',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/yenneti/.node-gyp/10.4.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/yenneti/cryptochar/node/node_modules/canvas',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/yenneti/cryptochar/node/node_modules/canvas/build'
SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
COPY Release/canvas-postbuild.node
CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:20:0:
../src/JPEGStream.h: In function ‘booleanempty_closure_output_buffer(j_compress_ptr)’:
../src/JPEGStream.h:42:108: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)dest->closure->fn, 2, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
In file included from ../src/Canvas.cc:20:0:
../src/JPEGStream.h: In function ‘void term_closure_destination(j_compress_ptr)’:
../src/JPEGStream.h:63:113: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)dest->closure->fn, 2, data_argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
In file included from ../src/Canvas.cc:20:0:
../src/JPEGStream.h:71:112: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)dest->closure->fn, 2, end_argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
../src/Canvas.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Canvas::New(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Canvas.cc:76:76: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
if (info[2]->IsString()) type = !strcmp("pdf", *String::Utf8Value(info[2]))
^
In file included from /home/yenneti/.node-gyp/10.4.1/include/node/v8.h:26:0,
from ../src/Canvas.h:11,
from ../src/Canvas.cc:7:
/home/yenneti/.node-gyp/10.4.1/include/node/v8.h:2846:28: note: declared here
explicit Utf8Value(Local<v8::Value> obj));
^
/home/yenneti/.node-gyp/10.4.1/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/Canvas.cc:78:48: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
: !strcmp("svg", *String::Utf8Value(info[2]))
^
In file included from /home/yenneti/.node-gyp/10.4.1/include/node/v8.h:26:0,
from ../src/Canvas.h:11,
from ../src/Canvas.cc:7:
/home/yenneti/.node-gyp/10.4.1/include/node/v8.h:2846:28: note: declared here
explicit Utf8Value(Local<v8::Value> obj));
^
/home/yenneti/.node-gyp/10.4.1/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/Canvas.cc: In static member function ‘static void Canvas::ToBufferAsyncAfter(uv_work_t*)’:
../src/Canvas.cc:221:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
closure->pfn->Call(1, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:1618:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/Canvas.cc:226:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
closure->pfn->Call(2, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:1618:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/Canvas.cc: In function ‘cairo_status_t streamPNG(void*, const uint8_t*, unsigned int)’:
../src/Canvas.cc:377:102: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)closure->fn, 3, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
../src/Canvas.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Canvas::StreamPNGSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Canvas.cc:446:103: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)closure.fn, 1, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
../src/Canvas.cc:452:103: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local<v8::Function>)closure.fn, 1, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
../src/Canvas.cc: In function ‘cairo_status_t streamPDF(void*, const uint8_t*, unsigned int)’:
../src/Canvas.cc:476:77: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), closure->fn, 3, argv);
^
In file included from ../src/Canvas.h:22:0,
from ../src/Canvas.cc:7:
../../nan/nan.h:929:46: note: declared here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^~~~~~~~~~~~
In file included from ../src/Canvas.cc:8:0:
../src/PNG.h: In function ‘cairo_status_tcanvas_write_png(cairo_surface_t*, png_rw_ptr, void*)’:
../src/PNG.h:73:20: warning: variable ‘status’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
cairo_status_t status = CAIRO_STATUS_SUCCESS;
^~~~~~
CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
../src/CanvasGradient.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Gradient::AddColorStop(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/CanvasGradient.cc:83:32: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
String::Utf8Value str(info[1]);
^
In file included from /home/yenneti/.node-gyp/10.4.1/include/node/v8.h:26:0,
from ../src/Canvas.h:11,
from ../src/CanvasGradient.cc:9:
/home/yenneti/.node-gyp/10.4.1/include/node/v8.h:2846:28: note: declared here
explicit Utf8Value(Local<v8::Value> obj));
^
/home/yenneti/.node-gyp/10.4.1/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
In file included from ../src/CanvasPattern.cc:9:0:
../src/Image.h:19:10: fatal error: gif_lib.h: No such file or directory
#include <gif_lib.h>
^~~~~~~~~~~
compilation terminated.
canvas.target.mk:121: recipe for target 'Release/obj.target/canvas/src/CanvasPattern.o' failed
make: Leaving directory '/home/yenneti/cryptochar/node/node_modules/canvas/build'
make: *** [Release/obj.target/canvas/src/CanvasPattern.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit(/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.13.0-45-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/yenneti/cryptochar/node/node_modules/canvas
gyp ERR! node -v v10.4.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
我在安装chartjs-node时遇到错误。谢谢!我已经尝试过sudo npm install了。仍然会出现错误。无法解决我们的问题。有什么办法可以解决此问题?
答案 0 :(得分:0)
您是否按照此处所述安装了import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0,100,size=(10, 4)), columns=list('ABCD'))
serialized=df.to_json()
print(serialized)
deserialized=pd.read_json(serialized)
print(deserialized)
和Cairo? https://github.com/Automattic/node-canvas#installation
您使用的是哪个节点版本?确保chart.js
支持它。