在搭建一个项目的前端部分时,正常流程是首先要运行npm install,之后npm run dev,但是这里在npm install时,发生了这样的报错
截图如下
然后下面还有这样的错误
生成失败。
“D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-sass\build\binding.sln”(默认目标) (1) ->
“D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标) (2) ->
“D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标) (3) ->
D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“D:\Microsoft.Cpp.Defau
lt.props
”。请确认 声明中的路径正确,且磁盘上存在该文件。
0 个警告
1 个错误
已用时间 00:00:00.74
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command “C:\Program Files\nodejs\node.exe” “D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-gyp\bin\node-gyp.js” “rebuild” “-
-verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
gyp ERR! cwd D:\IdeaWorkspace\mall-admin-web-master\node_modules\node-sass
gyp ERR! node -v v14.17.5
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of echarts@^4.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of echarts@>3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,"arch
":“x64”})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admister\AppData\Roaming\npm-cache_logs\2022-06-04T08_36_55_993Z-debug.log
首先有这几种办法,根据在网上找和对日志文件的分析结合,大多是在node sass上下功夫,那么是否是没有安装这个模块呢
1、 安装sass
在idea或者vscode的终端里运行命令
npm install node-sass
安装成功后,再执行npm install,如下图,成功
之后进行npm run dev
部署成功
2、 是否是没有管理员权限?
找到idea安装目录
赋予管理员权限
应用后就可以了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)