Taro: 项目初始化编译 找不到项目配置文件config/index

Created on 3 Jun 2020  ·  6Comments  ·  Source: NervJS/taro

问题描述

项目初始化编译
运行:yarn dev:weapp
报错:找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
单纯的初始化有问题,没有改动任何配置

复现步骤

1.npm install -g @tarojs/[email protected]
2.taro init taro-mini(选择js、sass、mobx)
3.cd taro-mini/
4.yarn dev:weapp

期望行为

正常编译运行

报错信息(截图上传不了)

$ yarn dev:weapp
yarn run v1.13.0
$ npm run build:weapp -- --watch

[email protected] build:weapp D:\workspace2\taro-mini
taro build --type weapp "--watch"

👽 Taro v2.2.3

找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: taro build --type weapp "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\huangjie04\AppData\Roaming\npm-cache_logs\2020-06-03T05_36_14_770Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

系统信息(截图上传不了)

操作系统 win10 64位
Node版本:12.13.0
taro版本:2.2.1

$ taro info
👽 Taro v2.2.1

Taro CLI 2.2.1 environment info:
System:
OS: Windows 10
Binaries:
Node: 12.13.0 - D:\nodejs\node.EXE
Yarn: 1.13.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.12.0 - D:\nodejs\npm.CMD

补充信息

看了相关 issue,基本都是因为使用了 ts 导致的
但是我选的模板不是 ts,文件名是 config/index.js

question

Most helpful comment

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10就会报这个问题,我也遇到了。我换成2.2.6就好了,望知

All 6 comments

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10会出现这个问题,换成2.2.6的脚手架就可以了。

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10就会报这个问题,我也遇到了。我换成2.2.6就好了,望知

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10就会报这个问题,我也遇到了。我换成2.2.6就好了,望知

感谢帮助,但是我使用 2.2.6 版本还是有问题

问题:
安装了 2.2.6 版本,项目依赖也是 2.2.6
但是开发环境编译时还是用的 2.2.3
报错:找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!

步骤:

  1. npm i @tarojs/[email protected] -g
  2. taro -V taro-info 均显示 2.2.6
  3. taro init taro-mini 新建项目,package.json 里 taro 版本是 2.2.6
    "@tarojs/taro": "2.2.6",
  4. yarn dev:weapp
    $ yarn dev:weapp
    yarn run v1.13.0
    $ npm run build:weapp -- --watch

[email protected] build:weapp D:\workspace2\taro-mini
taro build --type weapp "--watch"

👽 Taro v2.2.3

找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: taro build --type weapp "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\huangjie04\AppData\Roaming\npm-cache_logs\2020-06-04T01_51_33_553Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10就会报这个问题,我也遇到了。我换成2.2.6就好了,望知

感谢帮助,但是我使用 2.2.6 版本还是有问题

问题:
安装了 2.2.6 版本,项目依赖也是 2.2.6
但是开发环境编译时还是用的 2.2.3
报错:找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!

步骤:

  1. npm i @tarojs/[email protected] -g
  2. taro -V taro-info 均显示 2.2.6
  3. taro init taro-mini 新建项目,package.json 里 taro 版本是 2.2.6
    "@tarojs/taro": "2.2.6",
  4. yarn dev:weapp
    $ yarn dev:weapp
    yarn run v1.13.0
    $ npm run build:weapp -- --watch

[email protected] build:weapp D:\workspace2\taro-mini
taro build --type weapp "--watch"

👽 Taro v2.2.3

找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: taro build --type weapp "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\huangjie04\AppData\Roaming\npm-cache_logs\2020-06-04T01_51_33_553Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

这就要检查一下你的环境变量了

没有复现该问题,可以附一个 demo 看看

2.2.6以前的版本在win10就会报这个问题,我也遇到了。我换成2.2.6就好了,望知

感谢帮助,但是我使用 2.2.6 版本还是有问题
问题:
安装了 2.2.6 版本,项目依赖也是 2.2.6
但是开发环境编译时还是用的 2.2.3
报错:找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
步骤:

  1. npm i @tarojs/[email protected] -g
  2. taro -V taro-info 均显示 2.2.6
  3. taro init taro-mini 新建项目,package.json 里 taro 版本是 2.2.6
    "@tarojs/taro": "2.2.6",
  4. yarn dev:weapp
    $ yarn dev:weapp
    yarn run v1.13.0
    $ npm run build:weapp -- --watch

[email protected] build:weapp D:\workspace2\taro-mini
taro build --type weapp "--watch"

👽 Taro v2.2.3
找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: taro build --type weapp "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\huangjie04\AppData\Roaming\npm-cache_logs\2020-06-04T01_51_33_553Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

这就要检查一下你的环境变量了

已解决,和环境变量没关系
yarn dev:weapp 有配置缓存,每次都是用的 2.2.3
换成 npm run dev:weapp + taro cli 2.2.6 可以解决

感谢两位的帮助!

Was this page helpful?
0 / 5 - 0 ratings