这是我尝试通过npm start
命令启动React应用程序时的错误
npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:\Users\DELL\Desktop\works\package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\DELL\Desktop\works\package.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\DELL\AppData\Roaming\npm-cache\_logs\2020-03-06T11_16_42_885Z-debug.log
答案 0 :(得分:2)
通常,这种类型的错误发生在npm和nodejs版本不兼容的情况下。尝试升级您的npm和节点,如果您使用的是ubuntu os,则可以使用以下命令进行升级:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node//bin/node /usr/bin/nodejs
对于Windows,请按以下步骤操作:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
有关更多详细信息,请点击此处https://github.com/felixrieseberg/npm-windows-upgrade