`npm i core-js@latest` 不会安装,因为它无法构建... core-js@<3.3?

ruf*_*fin 6 npm core-js

我正在尝试为一个旧的、未维护的库恢复构建以便我们可以检查一些更改(或发布一个分支),让它与另一个更新的库(即 Bootstrap 4,但这对这个问题并不重要)一起很好地发挥作用) .

在尝试 vanillanpm i时,首先我发现了一些地方,因为~vs^冲突,库的 package.json 与其依赖项的依赖项发生冲突——依赖项对版本更宽容,所以我将主项目中的一些依赖项从~改为^匹配。没什么大不了。

但后来…… npm i在它最终放弃之前,它陷入了看起来像是正在建造的东西的地方。

在它似乎挂起之前显示的最后一行是这样的:

?                  ? ? reify:rxjs: timing reifyNode:node_modules/selenium-webdriver Completed in 8604ms
Run Code Online (Sandbox Code Playgroud)

然后,它调用clangmake遍地的一段时间(在MacOS大苏尔,我可以看到在终端的标题栏中的命令),最后才重新进入npm i和呕吐所有的地方。

呕吐开始于:

npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated
npm WARN deprecated core-js@1.2.7: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Applications/projects/angularjs-dropdown-multiselect/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
Run Code Online (Sandbox Code Playgroud)

这个问题似乎至少是相似的,因为它有类似的问题node-sass,但是库node-sass它的 package.json中没有任何地方,这表明它是一个依赖项的依赖项,它正在抓取 node-sass ......所以我不是确定如何从我所在的位置编辑 node-sass 依赖项,而无需猜测很多依赖项版本。


尝试安装 core-js@latest

好的。让我们尝试安装大于3.3 的core-js ,看看我们是否可以强制它以某种方式工作。

事实上,让我们尝试获取最新的(看起来是3.13 atm)...

npm i -D core-js@latest
Run Code Online (Sandbox Code Playgroud)

这是奇怪的事情:

这给了我同样的错误!

就像字面上相同的东西:

npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
Run Code Online (Sandbox Code Playgroud)

嗯?core-js@latest 需要 core-js@<3.3 来构建?

这里发生了什么?


更多日志!

我将尝试从npm Err!上面粘贴后的日志熨平板中选择看起来有用的东西,以防万一。需要明确的是,这是在第一次尝试npm i整个库,以及IS NOTnpm install -D core-js@latest

npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/usr/local/bin/node',
npm ERR! gyp verb cli   '/Applications/projects/angularjs-dropdown-multiselect/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
Run Code Online (Sandbox Code Playgroud)

......然后有几次这样的味道:

npm ERR! gyp verb `which` succeeded for `make` /usr/bin/make
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/libsass/src/ast.cpp:2:
npm ERR! ../src/libsass/src/ast.hpp:1361:25: warning: loop variable 'numerator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
npm ERR!         for (const auto numerator : numerator_units())
npm ERR!                         ^
npm ERR! ../src/libsass/src/ast.hpp:1361:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
npm ERR!         for (const auto numerator : numerator_units())
npm ERR!              ^~~~~~~~~~~~~~~~~~~~~~
npm ERR!                         &
npm ERR! ../src/libsass/src/ast.hpp:1363:25: warning: loop variable 'denominator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
npm ERR!         for (const auto denominator : denominator_units())
npm ERR!                         ^
npm ERR! ../src/libsass/src/ast.hpp:1363:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
npm ERR!         for (const auto denominator : denominator_units())
npm ERR!              ^~~~~~~~~~~~~~~~~~~~~~~~
npm ERR!                         &
npm ERR! 2 warnings generated.
Run Code Online (Sandbox Code Playgroud)

...在结束之前:

npm ERR! In file included from ../src/binding.cpp:3:
npm ERR! In file included from ../src/sass_context_wrapper.h:9:
npm ERR! In file included from ../src/custom_function_bridge.h:7:
npm ERR! ../src/callback_bridge.h:110:23: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR!       this->callback->Call(argv_v8.size(), &argv_v8[0])
npm ERR!                       ^
npm ERR! ../src/binding.cpp:32:16: note: in instantiation of member function 'CallbackBridge<Sass_Value *, void *>::operator()' requested here
npm ERR!   return bridge(argv);
npm ERR!                ^
npm ERR! ../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
npm ERR!   NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR!   ^
npm ERR! ../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR!                                        ^
npm ERR! 6 warnings generated.
npm ERR! ../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value'
npm ERR!   v8::String::Utf8Value string(value);
npm ERR!                         ^      ~~~~~
npm ERR! /Users/myLogin/.node-gyp/14.15.1/include/node/v8.h:3294:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value' for 1st argument
npm ERR!     Utf8Value(const Utf8Value&) = delete;
npm ERR!     ^
npm ERR! /Users/myLogin/.node-gyp/14.15.1/include/node/v8.h:3287:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
npm ERR!     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
npm ERR!     ^
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/create_string.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Applications/projects/angularjs-dropdown-multiselect/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
npm ERR! gyp ERR! System Darwin 20.3.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Applications/projects/angularjs-dropdown-multiselect/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Applications/projects/angularjs-dropdown-multiselect/node_modules/node-sass
npm ERR! gyp ERR! node -v v14.15.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1
Run Code Online (Sandbox Code Playgroud)

恐怕这超出了我的工资水平。这是怎么回事?

小智 0

不确定您是否仍在寻找答案,但万一其他人这个命令对我有用:

npm install --save core-js@^3