Nuxt.config.js 不在 cwd 中

问题描述 投票:0回答:4

我想在 Nuxt 项目中使用“npm rungenerate”,但我有错误:

Path C:/Users/Марина/OneDrive/Desktop/weHost/zabota-dialog/nuxt.config.js is not in cwd C:\Users\Марина\OneDrive\Desktop\weHost\zabota-dialog   

Nuxt.config.js 现在位于项目根目录中。文件内容:

export default {
  // Target: https://go.nuxtjs.dev/config-target
  target: "static",

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: "dialog-zabota",
    htmlAttrs: {
      lang: "en"
    },
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { hid: "description", name: "description", content: "" }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: ["./assets/less/main.less"],
  styleResources: {
    less: ["./assets/less/static/variables.less", "./assets/less/static/font-face.less"]
  },
  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: ["@nuxtjs/style-resources"],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [],

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {}
};

我做错了什么?为什么不运行?

vue.js nuxt.js
4个回答
2
投票

不知道如何修复它,因为我使用的是基于 UNIX 的系统,但实际上是有区别的

C:\Users\Марина\OneDrive\Desktop\weHost\zabota-dialog

C:/Users/Марина/OneDrive/Desktop/weHost/zabota-dialog/nuxt.config.js

斜杠不匹配,

\
vs
/
。您对系统进行了一些特定配置吗?


这个可能有帮助:Nodejs绝对路径在窗口中带有正斜杠

或任何带有

npm backslash windows
关键字的谷歌查询。


2
投票

我建议不要在路径中使用西里尔字母 .对我有帮助


0
投票

我认为这也可能是因为非 ASCII 字符而发生。我使用的是土耳其语 Windows,因此路径上有一个“/Masaüstü/”部分,我将文件夹移至 C:/src 并解决了问题。


0
投票

刚刚标准化了这里的路径,因为它是在以下文件的回复之一中建议的 节点模块@nux

© www.soinside.com 2019 - 2024. All rights reserved.