analizador faltante de la plantilla webpack de vue
Estaba configurando un proyecto vue usando la plantilla webpack como se indica aquí: http://vuejs-templates.github.io/webpack /
Sin embargo, después de ejecutar npm run dev solo para probar que la plantilla está funcionando, obtengo este error:
Failed to compile with 2 errors 21:49:02
error in ./src/App.vue
Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (path\node_modules\prettier\index.js:7051:13)
at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
at path\node_modules\prettier\index.js:31115:15
at Object.format (path\node_modules\prettier\index.js:31134:12)
at Object.module.exports (path\node_modules\vue-loader\lib\template-compiler\index.js:80:23)
@ ./src/App.vue 11:0-354
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
error in ./src/components/HelloWorld.vue
Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (path\node_modules\prettier\index.js:7051:13)
at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
at path\node_modules\prettier\index.js:31115:15
at Object.format (path\node_modules\prettier\index.js:31134:12)
at Object.module.exports (path\node_modules\vue-loader\lib\template-compiler\index.js:80:23)
¿Qué estoy haciendo mal?
7 answers
Prettier ha causado esta regresión en su actualización 1.13.0
que se produjo hoy. Downgrade a la versión anterior para corregir este error:
Npm install save save-dev [email protected]
Npm run dev
Eso debería hacer el truco.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-27 20:44:43
Si estás usando Yarn agrega esto a tu package.json
para forzar @vue/component-compiler-utils
a usar la versión correcta:
"resolutions": {
"@vue/component-compiler-utils/prettier": "1.12.1"
}
Luego haga una nueva instalación.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-28 02:00:35
Se fija en [email protected] y [email protected]. Así que actualízate.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-28 15:49:10
Dado que vue-cli
utiliza una interfaz API más bonita aquí y codificó las opciones, y se agregó una dependencia más bonita en el proyecto @vue/component-compiler-utils
.
Puedes intentar npm i prettier@~1.12.0
forzar la versión más bonita aquí.
Por cierto alguien hizo una pull request con la solución
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-27 23:45:22
Si estás usando laravel-mix
entonces esto lo arregló para mí:
Eliminar .\node_modules, quitar .\hilo.bloquear y luego agregar lo siguiente a .\paquete.json
"dependencies": {
...
"prettier": "1.12.1",
"vue-loader": "13.7.0"
...
},
"resolutions": {
"laravel-mix/vue-loader": "13.7.0",
"vue-loader/prettier": "1.12.1"
}
Ejecutar el hilo y todos deben estar trabajando.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-28 10:34:43
Obtuve el mismo error con el hilo, pero intenté npm i
y npm run dev
en su lugar y funcionó.
yarn v v1.5.1
npm -v 5.6.0
node -v v10.0.0
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-28 01:48:52
Uso Nuxt/Vue en Docker. Tengo el mismo error con docker build.
No funciona después de los siguientes comandos
rm -rf node_modules
npm install --save-dev [email protected]
npm run dev
Así que edité Dockerfile así y funcionó.
FROM node:8.11
RUN mkdir -p /app
COPY . /app
WORKDIR /app
RUN npm install && npm cache verify
RUN npm install --save-dev [email protected]
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "express"]
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-28 05:49:22