$ npm start
npm ERR! path C:\Users\erdai\OneDrive\Desktop\react crash todo\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\erdai\OneDrive\Desktop\react crash todo\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\erdai\AppData\Roaming\npm-cache\_logs\2019-09-20T01_23_10_337Z-debug.log
erdai@DESKTOP-7OPDBPA MINGW64 ~/OneDrive/Desktop/react crash todo
$ npm run-script start
npm ERR! path C:\Users\erdai\OneDrive\Desktop\react crash todo\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\erdai\OneDrive\Desktop\react crash todo\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\erdai\AppData\Roaming\npm-cache\_logs\2019-09-20T01_33_16_252Z-debug.log
答案1
从 vscode 终端窗口执行时出现同样的错误npm i socket.io
。不过它可以通过 Windows 命令提示符工作。重新安装 Node 解决了这个问题。