node.js - 安装 fiber@2.0.2 时出错
问题描述
我正在处理一个旧节点项目,在执行 npm install 时出现错误
节点版本:v13.8.0 Npm 版本:6.14.4 Mac OS 版本:10.15.5
起初,我遇到了在重新安装 X-Code 后已修复的 X-Code 问题。
这个问题似乎在 npm 页面上,但没有人回复它
> fibers@2.0.2 install /Users/cksharma/projects/step-library/some-library/node_modules/fibers
> node build.js || nodejs build.js
CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:68:2: error: no template named 'Handle'
Handle<String> NewLatin1String(Isolate* isolate, const char* string) {
^
../src/fibers.cc:69:10: error: no viable conversion from returned value of type 'Local<v8::String>' to function return type 'int'
return String::NewFromOneByte(isolate, (const uint8_t*)string, NewStringType::kNormal).ToLocalChecked();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fibers.cc:72:2: error: no template named 'Handle'
Handle<String> NewLatin1Symbol(Isolate* isolate, const char* string) {
^
../src/fibers.cc:73:10: error: no viable conversion from returned value of type 'Local<v8::String>' to function return type 'int'
return String::NewFromOneByte(isolate, (const uint8_t*)string, NewStringType::kNormal).ToLocalChecked();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fibers.cc:94:2: error: no template named 'Handle'
Handle<Object> NewInstance(Isolate* isolate, Local<Function> fn, int argc, Local<Value> argv[]) {
^
../src/fibers.cc:95:10: error: no viable conversion from returned value of type 'Local<v8::Object>' to function return type 'int'
return fn->NewInstance(isolate->GetCurrentContext(), argc, argv).ToLocalChecked();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fibers.cc:104:2: error: no template named 'Handle'
Handle<Number> ToNumber(Local<Value> value) {
^
../src/fibers.cc:105:10: error: no viable conversion from returned value of type 'Local<v8::Number>' to function return type 'int'
return value->ToNumber(Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fibers.cc:126:58: error: no template named 'Handle'
void Reset(Isolate* isolate, Persistent<T>& persistent, Handle<T> handle) {
^
../src/fibers.cc:139:7: error: variable has incomplete type 'void'
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:139:26: error: use of undeclared identifier 'Handle'
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:139:33: error: 'T' does not refer to a value
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:138:18: note: declared here
template <class T>
^
../src/fibers.cc:139:36: error: use of undeclared identifier 'handle'
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:139:48: error: expected '(' for function-style cast or type construction
void SetInternalPointer(Handle<T> handle, int index, void* val) {
~~~ ^
../src/fibers.cc:139:59: error: expected '(' for function-style cast or type construction
void SetInternalPointer(Handle<T> handle, int index, void* val) {
~~~~^
../src/fibers.cc:139:61: error: use of undeclared identifier 'val'
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:139:65: error: expected ';' at end of declaration
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
;
../src/fibers.cc:139:66: error: expected unqualified-id
void SetInternalPointer(Handle<T> handle, int index, void* val) {
^
../src/fibers.cc:143:27: error: use of undeclared identifier 'Handle'
void* GetInternalPointer(Handle<T> handle, int index) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.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:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/Cellar/node/13.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/cksharma/projects/step-library/step-library/node_modules/fibers
gyp ERR! node -v v13.8.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! fibers@2.0.2 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fibers@2.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我曾尝试检查 node-fiber github 页面,但没有发现任何有用的东西。
解决方案
我遇到了这个问题,因为当我将“typescript”作为 devDependency 移动时,“typescript”是一个正常的依赖项而不是 devDependency。
推荐阅读
- mysql - 如何在同一个表Mysql中包含返回值0
- javascript - Chrome.notifications.create 不起作用,不抛出 lastError
- dart - flutter Bloc模式——导航器后如何访问bloc数据
- bazel - 如何将版本化目标隐藏在非版本化目标后面?
- python - Python 电子邮件接收循环
- postgresql - psql 启动多个并发 .sql 脚本并限制进程
- com - 如何在给定头文件的情况下实现接口?
- tensorflow - 在 conda 环境中运行 train.py 时没有名为“tensorflow”的模块
- php - 如何修复 PHP 中的“PHP 致命错误:找不到类 'ffmpeg_movie'”错误
- python-3.x - 如何在 Python 中使用 BeautifulSoup 从 HTML 链接解析嵌套表?