如何修复运行npm run build时出现的npm错误



当我运行npm run build时,我遇到了这个错误,我无法修复它,因为我读取了github上的所有文章和堆栈上的相同quest-s:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:UsersКористувачDesktoptest/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:UsersКористувачDesktoptestpackage.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersКористувачAppDataLocalnpm-cache_logs2022-02-06T18_36_44_973Z-debug-0.log

嗨,您正试图在非节点项目中运行构建命令,请检查您是否在正确的目录中,如果不是,请通过运行npm init初始化项目

确保您位于正确的目录中。在运行该命令之前,您需要cd到正确的目录中。

如果您想确保package.json在目录中,请运行

ls | grep package.json

如果这没有显示文件,那么你可能在错误的目录中,或者你可能已经删除了package.json,在这种情况下,你可能必须重新创建它,或者从版本控制中恢复它。

最新更新