簡體   English   中英

運行 npm 安裝在 ubuntu 上給出 gyp err

[英]running npm install gives gyp err on ubuntu

我是新來的反應,我正在嘗試克隆 git 存儲庫。 我嘗試運行npm install來安裝依賴項,但第一次嘗試時出現錯誤。

第一個錯誤非常長(大約 7500 行錯誤代碼)並且無法解釋。 一段時間后,我意識到我的節點版本不是最新的。 那是14.06 我嘗試通過sudo npm cache clean -fsudo npm install -gnsudo n stable更新它,但它再次下載了相同的版本。 然后我發現我需要通過 ubuntu 軟件應用程序安裝它。 這樣做之后,當我運行node -v時,我的 nodejs 確實在版本v16.17.1上。

但是,當我運行npm install時,我仍然遇到同樣的錯誤。 然后我在某處看到運行 `` 將修復它。 我試過了,但它導致了一個錯誤 我運行npm install但這次錯誤代碼要小得多,我實際上可以在這里發布它。

這是錯誤代碼:

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

這是什么錯誤,我該如何解決? 我對此錯誤代碼一無所知。 我的 node-gyp 應該是最新的。

這是關於你的節點版本,將它與開發環境的節點版本匹配就可以解決問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM