我正在尝试在项目中执行命令 npm install ,它给了我这个错误:
$ npm install
> node-expat@2.3.18 install C:\Users\irodriba\Documents\project\node_modules\node-expat
> node-gyp rebuild
C:\Users\irodriba\Documents\project\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
C:\Users\irodriba\Documents\project\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\libexpat\version.c
Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar la compilación en paralelo, agregue el modificador "/m".
C:\Users\irodriba\Documents\project\node_modules\node-expat\build\deps\libexpat\expat.vcxproj(20,3): error MSB4019: No se encuentra el proyecto importado "C:\Microsoft.Cpp.Default.props". Asegúrese de que la ruta de acceso de la declaración <Import> es correcta y de que el archivo se encuentra en el disco.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\npm-lifecycle\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\irodriba\Documents\project\node_modules\node-expat
gyp ERR! node -v v8.16.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN eslint-config-airbnb-base@12.1.0 requires a peer of eslint@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base@12.1.0 requires a peer of eslint-plugin-import@^2.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package babel-preset-env is included as both a dev and production dependency.
npm WARN The package rimraf is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.18 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.18 install 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\irodriba\AppData\Roaming\npm-cache\_logs\2021-12-02T09_48_42_235Z-debug.log
我已经安装了 windows-build-tools 2015 和 python 2.7。我用这一行设置了 msvs_version:
npm config set msvs_version 2015
我用这一行设置了python路径:
npm config set python C:\Python27\python.exe