拉下来一个老项目 npm i 的时候报错
F:\tpy\tpy-web>npm i
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 EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'got@5.7.1',
npm WARN EBADENGINE required: { node: '>=0.10.0 <7' },
npm WARN EBADENGINE current: { node: 'v16.14.0', npm: '8.6.0' }
npm WARN EBADENGINE }
npm WARN deprecated set-value@2.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN deprecated mixin-deep@1.3.1: Critical bug fixed in v2.0.1, please upgrade to the latest version.
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated gulp-minify-css@1.2.4: Please use gulp-clean-css
npm WARN deprecated domelementtype@1.3.0: update to domelementtype@1.3.1
npm WARN deprecated set-value@0.4.3: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated flatten@1.0.2: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated har-validator@5.1.0: this library is no longer supported
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated chokidar@2.0.4: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.0.4: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.0.4: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.0.4: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated phantom@4.0.12: This package is no longer maintained
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated extract-text-webpack-plugin@2.1.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated uuid@2.0.3: 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 uuid@2.0.3: 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 request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated har-validator@4.2.1: this library is no longer supported
npm WARN deprecated uuid@3.3.2: 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 mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated buffer@3.6.0: This version of 'buffer' is out-of-date. You must update to v3.6.2 or newer
npm WARN deprecated tar@2.2.1: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated axios@0.17.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated axios@0.15.3: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated buffer@4.9.1: This version of 'buffer' is out-of-date. You must update to v4.9.2 or newer
npm WARN deprecated svgo@1.1.1: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.5.7: core-js@<3.4 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 unicode-5.2.0@0.7.5: Use @unicode/unicode-5.2.0 instead.
npm WARN deprecated resolve-url-loader@2.3.1: package is bloated with temp files (fixed in 2.3.2)
npm ERR! code 1
npm ERR! path F:\tpy\tpy-web\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.14.0 | win32 | x64
npm ERR! (node:8976) [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 info spawn C:\Python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'F:\tpy\tpy-web\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 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=auto',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'F:\tpy\tpy-web\node_modules\node-sass\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'F:\tpy\tpy-web\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Administrator\.node-gyp\16.14.0\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=C:\Users\Administrator\.node-gyp\16.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=F:\tpy\tpy-web\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\Users\Administrator\.node-gyp\16.14.0\<(target_arch)\node.lib',npm ERR! gyp info spawn args '-Dmodule_root_dir=F:\tpy\tpy-web\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 'F:\tpy\tpy-web\node_modules\node-sass\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (F:\tpy\tpy-web\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "F:\tpy\tpy-web\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd F:\tpy\tpy-web\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache_logs\2022-04-14T06_33_46_842Z-debug-0.log
下载淘宝镜像 npm install -g cnpm --registry=
再用cnpm运行 cnpm install
很多组件都没有维护了,你可以新建一个项目,将代码复制过去,自己一个一个的安装组件。修改某些代码
原因:
你的报错信息这两行是关键:
npm WARN EBADENGINE required: { node: '>=0.10.0 <7' },
npm WARN EBADENGINE current: { node: 'v16.14.0', npm: '8.6.0' }
这说明是本地node版本过高导致的
解决:
方案一:不改变原有项目,使用nvm本地管理多版本node,运行该项目时切换为对应低版本node即可
方案二:项目兼容高版本node
node-sass
安装报错了, 你当前node-sass
的版本是4.14.1
, node
版本是 16.14.0
我们去官网https://www.npmjs.com/package/node-sass 版本是多少
那根据这个规则,我们是不是可以调整node
或者node-sass`版本满足条件就可以了,下面有两种方案
node-sass
版本为6.x是不是就和node 16的匹配了,但这个不一定成功, 因为又其他的依赖关联的,可能就要node-sass
版本为4.14的才可以nvm
node包管理器,怎么安装我这里有教程 https://blog.csdn.net/z1832729975/article/details/121780592像上面修改node-sass
版本或者node版本之后,我们把node_modules
删除重新 npm install
就可以
npm cache clean --force后再npm i看看可不可以
解决方案一:npm升级到最新版本
备份package-lock.json
删除 package-lock.json 然后运行 npm install 和 npm update
看看最新版本能不能解决这个问题
解决方案二:降级npm版本
可能因为你安装了最新版本的npm,所以降级到一个旧版本。
只需在控制台中使用下面这个命令安装所需的版本,用所需版本号替换“XXX”即可。
npm install -g npm@"XXX"
下面这个链接有npm的所有版本,你可以安装所需的版本。
https://www.npmjs.com/package/npm?activeTab=versions
解决方案三:忽略此警告
忽略此警告即可。
这是版本冲突导致的问题
可以考虑更换一下npm版本(升高版本或降低版本)。
npm rebuild node-sass
可以么
1)老项目需要有个完整的copy,包括node_modules 这个目录,如此,就不需要在npm i 了!
2)npm不行,就用cnpm,我遇到过类似的问题,使用cnpm就好了,如下图: