1.首先尝试解决思路

  • npm报错就切换yarn , yarn报错就先切换npm
  • 删除 node_modules 跟  package-lock.json文件重新下载依

2.

报错信息

Module build failed: Error: Missing binding D:\vue-element-admin\node_modules\node-sass\vendor\win32-x64-83\binding.node

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 14.x

Found bindings for the following environments:

- Windows 64-bit with Node.js 14.x

This usually happens because your environment has changed since running `npm install`.

Run `npm rebuild node-sass` to download the binding for your current environment.

错误点

  • 模块构建失败,报错信息显示找不到D:\vue-element-admin\node_modules\node-sass\vendor\win32-x64-83\binding.node 绑定文件,且 Node Sass 无法找到当前环境(Windows 64 位和 Node.js 14.x)的绑定,尽管它找到了 Windows 64 位和 Node.js 14.x 的其他绑定,但可能由于环境变化导致该问题。

解决:运行 npm rebuild node-sass 来重新下载当前环境的绑定文件

npm rebuild node-sass

3.

报错信息

npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to https://registry.npm.taobao.org/only-allow failed, reason: connect ETIMEDOUT 124.200.113.104:443 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

错误点

  • npm 在尝试连接到 https://registry.npm.taobao.org/only-allow 时遇到了超时问题 (ETIMEDOUT)。

解决:可以切换回官方源试试

npm config set registry https://registry.npmjs.org/

        使用淘宝 npm 镜像

npm config set registry https://registry.npm.taobao.org

3.

操作:npm i 下载依赖得时候报错

报错信息

npm ERR! code EINTEGRITY
npm ERR! sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTq
wRtAh7JLoOzAQdVA== integrity checksum failed when using sha512: wanted sha512-n43JRhlU
KUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== but g
ot sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==. (7610 bytes)

解决:删除  package-lock.json 文件 ,重新  npm i  就能解决

 已解决


4.

操作:npm run dev 运行项目报错

报错信息

Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1343:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 9001
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-admin@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-admin@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

原因解析:

EADDRINUSE 错误表示端口 9001 已经被其他进程占用。这导致 npm run dev 命令无法启动开发服务器。

解决

一、在 Windows 上:

1.查找占用端口的进程:

   netstat -ano | findstr :9001

2.获取进程 ID (PID:注意最后一列的 PID(例如:25524)


 

3.使用 taskkill 终止该进程:

taskkill /PID 25524

二、如果前端项目本地运行

1.找到运行端口设置,一般是 vue.config.js 文件 ,或者全局搜索 报错得端口 9001

更换其他端口,重新npm run dev

port: '9000'

5.

操作:npm i 项目报错

报错信息

Rimraf versions prior to v4 are no longer supported warning node-sass > npmlog@4.1.2: This package is no longer supported. warning node-sass > node-gyp > npmlog@4.1.2: This package is no longer supported. warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning node-sass > true-case-path > glob@7.2.3: Glob versions prior to v9 are no longer supported warning node-sass > gaze > globule > glob@7.1.7: Glob versions prior to v9 are no longer supported warning node-sass > gaze > globule > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. warning node-sass > sass-graph > glob@7.2.3: Glob versions prior to v9 are no longer supported warning node-sass > node-gyp > fstream@1.0.12: This package is no longer supported. warning node-sass > node-gyp > fstream > rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported warning node-sass > npmlog > are-we-there-yet@1.1.7: This package is no longer supported. warning node-sass > npmlog > gauge@2.7.4: This package is no longer supported. warning node-sass > node-gyp > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. warning node-sass > node-gyp > tar > fstream@1.0.12: This package is no longer supported. warning node-sass > node-gyp > osenv@0.1.5: This package is no longer supported. warning node-sass > request > har-validator@5.1.5: this library is no longer supported warning node-sass > request > 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. warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > coa > q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > 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 warning rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported warning sass-resources-loader > glob@7.2.3: Glob versions prior to v9 are no longer supported warning shelljs > glob@7.2.3: Glob versions prior to v9 are no longer supported warning uglifyjs-webpack-plugin > uglify-es@3.3.9: support for ECMAScript is superseded by uglify-js as of v3.13.0 warning vue-loader > consolidate@0.14.5: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog warning webpack > acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: Upgrade to fsevents v2 to mitigate potential security issues warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated warning webpack-bundle-analyzer > bfj-node4@5.3.1: Switch to the bfj package for fixes and new features! warning webpack-dev-server-bird > del > rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported warning webpack-dev-server-bird > del > globby > glob@7.2.3: Glob versions prior to v9 are no longer supported warning webpack-dev-server-bird > sockjs > 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. warning webpack-dev-server-bird > bird-proxy-middleware > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning webpack-dev-server-bird > bird-proxy-middleware > delete > rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported warning webpack-dev-server-bird > bird-proxy-middleware > delete > matched > glob@7.2.3: Glob versions prior to v9 are no longer supported [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... [1/5] es5-ext [-/5] waiting... [-/5] waiting... [4/5] node-sass error $PROJECT_ROOT\node_modules\node-sass: Command failed. Exit code: 1 Command: node scripts/build.js Arguments: Directory: $PROJECT_ROOT\node_modules\node-sass Output: Building: C:\Program Files\nodejs\node.exe $PROJECT_ROOT\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'C:\Program Files\nodejs\node.exe', gyp verb cli '$PROJECT_ROOT\node_modules\node-gyp\bin\node-gyp.js', gyp verb cli 'rebuil

原因解析:

node-sass 安装失败:

  • node-sass 已经不再维护,建议迁移到 sass 或 sass-embedded。
  • node-sass 的安装失败可能是由于它依赖的本地构建工具和库不兼容当前环境。
    过时和废弃的依赖项:
  • 许多依赖项已经废弃或不再维护,建议更新这些依赖项以避免潜在的安全风险和兼容性问题。

3个解决方案:

1.迁移 node-sass 到 sass

# 卸载 node-sass
yarn remove node-sass

# 安装 sass
yarn add sass

2.更新其他过时的依赖项

# 安装 npm-check-updates
npm install -g npm-check-updates

# 更新 package.json 中的依赖项版本
ncu -u

# 安装更新后的依赖项
yarn install

3.重新下载适合当前环境的绑定

# 执行以下命令来重新构建 node-sass 模块
npm rebuild node-sass
# 然后尝试重新运行项目
yarn dev

 已解决


6. 

操作:git add .项目报错    2025/3/27

将远程拉起代码A项目复制到B项目得代码仓产生问题

报错信息warning: in the working copy of '.idea/inspectionProfiles/Project_Default.xml', LF will be replaced by CRLF the next time Git touches it

问题原因:

Windows系统默认使用CRLF(\r\n)​作为行尾符,而Linux/macOS使用LF(\n)​。当Git检测到文件中存在LF(例如从其他系统克隆的代码或编辑器生成),会自动将其转换为CRLF,并提示警告:warning: LF will be replaced by CRLF in .idea/inspectionProfiles/Project_Default.xml

解决方案:

 关闭自动转换(仅Windows环境)若项目仅在Windows开发,可关闭自动转换:
git config --global core.autocrlf false

若项目需在Windows/Linux/macOS多平台协作,建议统一使用LF作为行尾符:

git config --global core.autocrlf input

 已解决


7. 

操作:git add .项目报错    2025/3/29

报错信息

'D:/admin-management-vue' is owned by: (inconvertible) (S-1-5-21-3488846825-2989299151-1904946419-1001) but the current user is: PC-ZHAO/Administrator (S-1-5-21-991760465-3144659277-219158034-500) To add an exception for this directory, call: git config --global --add safe.directory 'D:admin-management-vue' PS D:\admin-management-vue>

 问题原因: Git 安全目录权限问题

Git 检测到当前用户(PC-ZHAO/Administrator)与仓库目录的所有者(S-1-5-21-3488846825-2989299151-1904946419-1001)不匹配,认为该目录可能被篡改,因此触发安全警告。

(造成的原因应该是我C盘 ,电脑重装了系统,git也是重新安装)

解决方案: 添加安全目录    

git config --global --add safe.directory 'D:/admin-management-vue'

 已解决


Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐