I was writing code for my app with Vue and everything worked perfectly. Then I started to create child components and I could not refresh the localhost anymore.
Now it says:
"Vetur can't find 'package.json" & "Vetur can't find 'tsconfig.json' or 'jsconfig.json"
and when I try to "npm run serve" in the cmd - then i get this:
C:\Users\cmana\Desktop\WebDeveloper\Vue app\vuetify-todo>npm run serve
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\cmana\Desktop\WebDeveloper\Vue app\vuetify-todo\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\cmana\Desktop\WebDeveloper\Vue app\vuetify-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\cmana\AppData\Roaming\npm-cache\_logs\2021-04-07T12_03_13_953Z-debug.log
Acording to this https://vuejs.github.io/vetur/guide/setup.html#project-setup - I tried to add the jsconfig.json file with this content. (I deleted all the child components so I only have these vue files (About, Todo, App) left.)
{
"include": [
"./src/views/About.vue",
"./src/views/Todo.vue",
"./src/App.vue"
]
}
Still nothing. Anybody any ideas? Thank you <3
Vetur can't find package.json in /xxxx/xxxxxx. If you don't have any package.json in your project, Vetur can't know the Vue version and component data from other libs. Vetur assumes that the version of Vue is less than 2.5.
to help us find the cause of the issue. Vetur can't find tsconfig.json, jsconfig.json in /xxxx/xxxxxx. If you don't have any tsconfig.json, jsconfig.json in your project, Vetur will use fallback settings. Some features such as including path alias, decorator, and import json won't work.
If it says cannot find module <some-module>, go to Vetur's client code installation directory and run yarn or npm install . This is usually caused by VS Code not correctly updating Vetur's dependencies from version to version. Paths: You can also try uninstall/reinstall Vetur. . For example:
If you want debug info, you can use Vetur: show doctor info command. You can use vetur.ignoreProjectWarning: true in vscode setting to close this warning. ⚠️ Notice ⚠️ : If you don't need (path alias/decorator/import json) feature, you can just close it. Vetur can't find package.json in /xxxx/xxxxxx.
Installing the EsLint extension should solve your problem
if you are on VS Code, search for the EsLint extension by publisher:"Dirk Baeumer", install it and approve the installation to start the EsLint server
Alternatively run this in the terminal
npm install eslint
in your workspace
The package.json file gets modified and your server will be up again
for further information on the EsLint extension you can check https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
Good luck!
First of all, in Visual Studio code, type:
Ctrl + Shift + p
This command, will open this window
Type: settings json in search bar, like this:
Open the first option: "Open Settings (JSON)".
Now, on JSON file, add this: "vetur.ignoreProjectWarning": true,
in the end of file, like this:
Restart Visual Studio Code and you're done!
Add "vetur.config.js" outside your project.
In this example below, "vetur.config.js" is added outside the project "vueProject":
Shrinking "vueProject" looks clearer:
Then, paste this code below to "vetur.config.js":
// vetur.config.js
/** @type {import('vls').VeturConfig} */
module.exports = {
// **optional** default: `{}`
// override vscode settings
// Notice: It only affects the settings used by Vetur.
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true
},
// **optional** default: `[{ root: './' }]`
// support monorepos
projects: [
'./packages/repo2', // shorthand for only root.
{
// **required**
// Where is your project?
// It is relative to `vetur.config.js`.
root: './packages/repo1',
// **optional** default: `'package.json'`
// Where is `package.json` in the project?
// We use it to determine the version of vue.
// It is relative to root property.
package: './package.json',
// **optional**
// Where is TypeScript config file in the project?
// It is relative to root property.
tsconfig: './tsconfig.json',
// **optional** default: `'./.vscode/vetur/snippets'`
// Where is vetur custom snippets folders?
snippetFolder: './.vscode/vetur/snippets',
// **optional** default: `[]`
// Register globally Vue component glob.
// If you set it, you can get completion by that components.
// It is relative to root property.
// Notice: It won't actually do it. You need to use `require.context` or `Vue.component`
globalComponents: [
'./src/components/**/*.vue'
]
}
]
}
in VSCode
ctrl + p
open setting.json
add this line:
"vetur.ignoreProjectWarning": true,
this will ignore the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With