linux:ubuntu21.04:npm安裝@vue/cli時報錯(@vue/cli 4.5.13/npm 7.21.0/node 14.17.1)
阿新 • • 發佈:2021-08-23
一,第一次安裝時報錯:
root@lhdpc:/usr/local/source# npm install -g @vue/cli npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated urix@截圖: 解決:安裝make0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated apollo-tracing@0.15.0: The `apollo-tracing` package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for detailsnpm WARN deprecated graphql-extensions@0.15.0: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/ npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm WARN deprecated graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead npm ERR! code 1 npm ERR! path /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@14.17.1 | linux | x64 npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3" npm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/14.17.1" npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp" npm ERR! gyp info spawn /usr/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/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 '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/tmp/.node-gyp/14.17.1/include/node/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=/tmp/.node-gyp/14.17.1', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/14.17.1/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate', 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 ERR! build error npm ERR! gyp ERR! stack Error: not found: make npm ERR! gyp ERR! stack at getNotFoundError (/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:10:17) npm ERR! gyp ERR! stack at /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:57:18 npm ERR! gyp ERR! stack at new Promise (<anonymous>) npm ERR! gyp ERR! stack at step (/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:54:21) npm ERR! gyp ERR! stack at /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:71:22 npm ERR! gyp ERR! stack at new Promise (<anonymous>) npm ERR! gyp ERR! stack at subStep (/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:69:33) npm ERR! gyp ERR! stack at /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:80:22 npm ERR! gyp ERR! stack at /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/isexe/index.js:42:5 npm ERR! gyp ERR! stack at /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/isexe/mode.js:8:5 npm ERR! gyp ERR! System Linux 5.11.0-31-generic npm ERR! gyp ERR! command "/usr/local/soft/node-v14.17.1-linux-x64/bin/node" "/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate npm ERR! gyp ERR! node -v v14.17.1 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-08-23T03_25_56_917Z-debug.log
root@lhdpc:/usr/local/source# whereis make make: root@lhdpc:/usr/local/source# apt-get install make 正在讀取軟體包列表... 完成 正在分析軟體包的依賴關係樹... 完成 正在讀取狀態資訊... 完成 下列軟體包是自動安裝的並且現在不需要了: libllvm11 使用'apt autoremove'來解除安裝它(它們)。 建議安裝: make-doc 下列【新】軟體包將被安裝: make 升級了 0 個軟體包,新安裝了 1 個軟體包,要解除安裝 0 個軟體包,有 0 個軟體包未被升級。 需要下載 167 kB 的歸檔。 解壓縮後會消耗 414 kB 的額外空間。 獲取:1 http://cn.archive.ubuntu.com/ubuntu hirsute/main amd64 make amd64 4.3-4ubuntu1 [167 kB] 已下載 167 kB,耗時 2秒 (98.6 kB/s) 正在選中未選擇的軟體包 make。 (正在讀取資料庫 ... 系統當前共安裝有 201167 個檔案和目錄。) 準備解壓 .../make_4.3-4ubuntu1_amd64.deb ... 正在解壓 make (4.3-4ubuntu1) ... 正在設定 make (4.3-4ubuntu1) ... 正在處理用於 man-db (2.9.4-2) 的觸發器 …檢視效果
root@lhdpc:/usr/local/source# whereis make make: /usr/bin/make /usr/share/man/man1/make.1.gz
說明:劉巨集締的架構森林是一個專注架構的部落格,地址:https://www.cnblogs.com/architectforest
對應的原始碼可以訪問這裡獲取:https://github.com/liuhongdi/
說明:作者:劉巨集締 郵箱: [email protected]
二,第二次安裝時報錯:
root@lhdpc:/usr/local/source# npm install -g @vue/cli npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated apollo-tracing@0.15.0: The `apollo-tracing` package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for details npm WARN deprecated graphql-extensions@0.15.0: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/ npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm WARN deprecated graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead npm ERR! code 1 npm ERR! path /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! make: 進入目錄“/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil/build” npm ERR! CC(target) Release/obj.target/bufferutil/src/bufferutil.o npm ERR! make: 離開目錄“/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil/build” npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@14.17.1 | linux | x64 npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3" npm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/14.17.1" npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp" npm ERR! gyp info spawn /usr/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/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 '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/tmp/.node-gyp/14.17.1/include/node/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=/tmp/.node-gyp/14.17.1', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/14.17.1/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil', 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 info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! make: cc: 沒有那個檔案或目錄 npm ERR! make: *** [bufferutil.target.mk:111:Release/obj.target/bufferutil/src/bufferutil.o] 錯誤 127 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 (/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:375:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) npm ERR! gyp ERR! System Linux 5.11.0-31-generic npm ERR! gyp ERR! command "/usr/local/soft/node-v14.17.1-linux-x64/bin/node" "/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/bufferutil npm ERR! gyp ERR! node -v v14.17.1 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-08-23T03_40_08_878Z-debug.log截圖: 解決:安裝gcc
root@lhdpc:/usr/local/source# whereis cc cc: root@lhdpc:/usr/local/source# apt-get install gcc安裝完成後檢視效果:
root@lhdpc:/usr/local/source# whereis cc cc: /usr/bin/cc /usr/share/man/man1/cc.1.gz
三,第三次安裝報錯:
root@lhdpc:/usr/local/source# npm install -g @vue/cli npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated apollo-tracing@0.15.0: The `apollo-tracing` package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for details npm WARN deprecated graphql-extensions@0.15.0: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/ npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm WARN deprecated graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead npm ERR! code 1 npm ERR! path /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! make: 進入目錄“/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate/build” npm ERR! CC(target) Release/obj.target/validation/src/validation.o npm ERR! SOLINK_MODULE(target) Release/obj.target/validation.node npm ERR! make: 離開目錄“/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate/build” npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@14.17.1 | linux | x64 npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3" npm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/14.17.1" npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp" npm ERR! gyp info spawn /usr/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/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 '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/tmp/.node-gyp/14.17.1/include/node/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=/tmp/.node-gyp/14.17.1', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/14.17.1/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate', 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 info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! make: g++: 沒有那個檔案或目錄 npm ERR! make: *** [validation.target.mk:139:Release/obj.target/validation.node] 錯誤 127 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 (/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:375:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) npm ERR! gyp ERR! System Linux 5.11.0-31-generic npm ERR! gyp ERR! command "/usr/local/soft/node-v14.17.1-linux-x64/bin/node" "/usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /usr/local/soft/node-v14.17.1-linux-x64/lib/node_modules/@vue/cli/node_modules/utf-8-validate npm ERR! gyp ERR! node -v v14.17.1 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-08-23T03_48_41_338Z-debug.log截圖: 解決:安裝g++:
root@lhdpc:/usr/local/source# apt-get install g++
檢視安裝後效果:
root@lhdpc:/usr/local/source# whereis g++ g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz
四,第四次安裝成功:
建立符號連結root@lhdpc:~# ln -s /usr/local/soft/node-v14.17.1-linux-x64/bin/vue /usr/local/bin/vue檢視檔案
root@lhdpc:~# whereis vue vue: /usr/local/bin/vue檢視版本
root@lhdpc:/usr/local/source# vue -V @vue/cli 4.5.13
五,檢視npm/node版本
root@lhdpc:/usr/local/source# npm -v 7.21.0 root@lhdpc:/usr/local/source# node -v v14.17.1
六,檢視linux版本:
root@lhdpc:/usr/local/source# cat /etc/os-release NAME="Ubuntu" VERSION="21.04 (Hirsute Hippo)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 21.04" VERSION_ID="21.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=hirsute UBUNTU_CODENAME=hirsute