我正试图执行我从github在我的机器上下载的代码。我已经在vscode中设置了angular的环境和问题npm ERR!代码1是不断出现。我在堆栈溢出搜索期间尝试了一些替代方案,但没有成功。下面是错误,我希望有人知道解决方法。
PS C:Userscborge14DocumentsL&DpdAcademypdacademy-frontend-angular> npm i
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! code 1
npm ERR! path C:Userscborge14DocumentsL&DpdAcademypdacademy-frontend-angularnode_modules@parcelwatcher
npm ERR! command failed
npm ERR! command C:WINDOWSsystem32cmd.exe /d /s /c node-gyp-build
npm ERR! 'DpdAcademypdacademy-frontend-angularnode_modules.bin' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
npm ERR! node:internal/modules/cjs/loader:936
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'C:Userscborge14Documentsnode-gyp-buildbin.js'
npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
npm ERR! at node:internal/main/run_main_module:17:47 {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: []
npm ERR! }
npm ERR! A complete log of this run can be found in:
npm ERR! C:Userscborge14AppDataLocalnpm-cache_logs2022-05-06T22_29_27_170Z-debug-0.log
Thanks in advance
要解决这个问题,首先删除node_modules
文件夹(如果它存在于您的项目解决方案中),然后清除npm cash。您可以使用命令或直接删除此目录下的npm-cache
文件夹:
C:Users'your-user-name'AppDataRoaming
或
C:UsersuserAppDatalocal
完成这些步骤后,npm命令应该可以正常工作了。