I recently used vue create
to start a project and everything went smoothly. However, when I tried to run npm run serve
, I encountered an issue where node couldn't locate the package.json
file that was generated during the project creation process.
This problem isn't unique to Vue as I faced a similar issue while learning webpack before diving into vue cli. Unfortunately, I wasn't able to resolve it then either.
My next step is to reinstall node to see if it resolves the problem, although I'm not very optimistic about it.
Additionally, it seems like npm always searches in the wrong directory or expects files to be in the wrong place.
System information:
- Windows 10 version 2004 os build 19041.1052
- node version 14.17.0
Error:
0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'serve' 1 verbose cli ] 2 info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="513f213c11677f60657f6062">[email protected]</a> 3 info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9af4f5feffdaecabaeb4abadb4aa">[email protected]</a> 4 verbose stack Error: ENOENT: no such file or directory, open 'C:\VueProjects\package. 5 verbose cwd C:\VueProjects 6 verbose Windows_NT 10.0.19041 7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve" 8 verbose node v14.17.0 9 verbose npm v6.14.13 10 error code ENOENT 11 error syscall open 12 error path C:\VueProjects\package.json 13 error errno -4058 14 error enoent ENOENT: no such file or directory, open 'C:\VueProjects\package.json' 15 error enoent This is related to npm not being able to find a file. 16 verbose exit [ -4058, true ]
https://i.stack.imgur.com/LF578.png
https://i.stack.imgur.com/YjGWM.png
ps. Ill be watching this as much as I can wile trying to fix it as well