首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行npm安装会在ubuntu上产生gyp错误。

运行npm安装会在ubuntu上产生gyp错误。
EN

Stack Overflow用户
提问于 2022-09-30 17:52:28
回答 1查看 122关注 0票数 2

我刚开始反应,我正试图克隆一个git存储库。我试图运行npm install来安装依赖项,但在第一次尝试时出现了一个错误。

第一个错误确实很长(大约7500行错误代码),而且没有解释。过了一会儿,我意识到我的节点版本不是最新的。是14.06。我试图通过sudo npm cache clean -fsudo npm install -g nsudo n stable更新它,但是它再次下载了相同的版本。然后我发现我需要通过ubuntu软件应用程序来安装它。在这样做之后,当我运行v16.17.1时,nodejs确实在版本node -v上。

但是,在运行npm install时,仍然会遇到相同的错误。然后我在某个地方看到运行会修复它。我试过了,但是它导致了一个错误,我运行了npm install,但是这次错误代码要小得多,我可以在这里发布它。

这里是错误代码:

代码语言:javascript
复制
turgut@turgut-N56VZ:~/Desktop/VSCodeProjects/videoo-react$ npm install --nodedir=/node/src/
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated mini-create-react-context@0.4.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated react-resizable-box@2.1.0: CAUTION react-resizable-box is renamed to re-resizable. Please use re-resizable if you want to use latest package.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @babel/polyfill@7.12.1:  This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated vis@4.21.0-EOL: Please consider using https://github.com/visjs
npm WARN deprecated core-js-pure@3.20.3: core-js-pure@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.
npm WARN deprecated core-js@3.20.3: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh /tmp/postinstall-358bd37b.sh
npm ERR! Building: /usr/local/bin/node /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
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   '/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/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 ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.17.1 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` succeeded python2 /usr/bin/python2
npm ERR! gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.18
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir compiling against specified --nodedir dev files: /node/src/
npm ERR! gyp verb build dir attempting to create "build" dir: /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/build/config.gypi
npm ERR! (node:10374) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/node/src/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/node/src/',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/node/src/$(Configuration)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: /node/src/common.gypi not found (cwd: /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass) while reading includes of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.15.0-48-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/turgut/Desktop/VSCodeProjects/videoo-react/node_modules/react-app-rewire-sass-rule/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.17.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

这个错误是什么?我如何修复这个错误?我对这个错误代码什么都不懂。我的节点应该是最新的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-30 18:15:25

这是关于您的节点版本,将其与开发环境的节点版本匹配将解决问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73912343

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档