Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[taro 2.0.0]MAC taro创建失败 #5285

Closed
kerncheng opened this issue Jan 10, 2020 · 16 comments
Closed

[taro 2.0.0]MAC taro创建失败 #5285

kerncheng opened this issue Jan 10, 2020 · 16 comments
Assignees

Comments

@kerncheng
Copy link

kerncheng commented Jan 10, 2020

Need help? Go and open issue: https://github.com/NervJS/taro/issues/new

✔ 拉取远程模板仓库成功!
? 请输入项目介绍! demo
? 是否需要使用 TypeScript ? No
? 请选择 CSS 预处理器(Sass/Less/Stylus) Less
? 请选择模板 默认模板

SyntaxError: Error parsing /usr/local/lib/node_modules/@tarojs/cli/templates/default/package.json: Unexpected token < in JSON at position 183
    at parse (<anonymous>)
    at readPackage (internal/modules/cjs/loader.js:255:20)
    at readPackageScope (internal/modules/cjs/loader.js:280:19)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:17)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@tarojs/cli/dist/create/init.js:147:54)
    at Generator.next (<anonymous>) {
  path: '/usr/local/lib/node_modules/@tarojs/cli/templates/default/package.json'
}
➜  ReactProjects
@taro-bot
Copy link

taro-bot bot commented Jan 10, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@kerncheng kerncheng reopened this Jan 10, 2020
@Garfield550
Copy link
Collaborator

Taro 版本?

@kerncheng
Copy link
Author

Taro 版本?

👽 Taro v2.0.0

Taro CLI 2.0.0 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.6.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm

@damaohub
Copy link

是不是用less需要额外配置呢,我用less也是出问题。
Module build failed (from ./node_modules/@tarojs/webpack-runner/node_modules/less-loader/dist/cjs.js):

@shenghanqin shenghanqin changed the title MAC taro创建失败 [taro 2.0.0 beta]MAC taro创建失败 Jan 10, 2020
@taro-bot
Copy link

taro-bot bot commented Jan 10, 2020

CC @luckyadam

@shenghanqin shenghanqin changed the title [taro 2.0.0 beta]MAC taro创建失败 [taro 2.0.0]MAC taro创建失败 Jan 10, 2020
@shenghanqin shenghanqin removed the beta label Jan 10, 2020
@wq1308786830
Copy link

+1

@damaohub
Copy link

damaohub commented Jan 10, 2020

是不是用less需要额外配置呢,我用less也是出问题。
Module build failed (from ./node_modules/@tarojs/webpack-runner/node_modules/less-loader/dist/cjs.js):

回来说一下,发现这个是因为less里的each方法解析不了。建议把taro-webpack-runner里的less版本升级。

@wq1308786830
Copy link

是不是用less需要额外配置呢,我用less也是出问题。
Module build failed (from ./node_modules/@tarojs/webpack-runner/node_modules/less-loader/dist/cjs.js):

回来说一下,发现这个是因为less里的each方法解析不了。建议把taro-webpack-runner里的less版本升级。

不是的,我其他几个模板使用都一样的问题

@kerncheng
Copy link
Author

我的不是less问题,应该是跟我node版本太高有关系, 替换模板出问题了,我降级了node v12

Taro CLI 2.0.0 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.1 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm

@Garfield550 Garfield550 self-assigned this Jan 10, 2020
@Garfield550 Garfield550 reopened this Jan 10, 2020
@Garfield550
Copy link
Collaborator

之前出现过这种问题,这两天看一下。

问一下是 Node 哪个版本。

@kerncheng
Copy link
Author

之前出现过这种问题,这两天看一下。

问一下是 Node 哪个版本。

node v13.6 有问题 ,出现了这个问题

@Garfield550
Copy link
Collaborator

了解了

@Garfield550
Copy link
Collaborator

Node.js 13 又改了 require 的行为,之前是 require 同目录下的 js 文件时,package.jsonmain 字段会出错,现在的行为成了,只要有一个不合规范的 package.json 就会报错。

image

@luckyadam 我觉得我们需要考虑一套新的模版机制,你觉得呢

@luckyadam
Copy link
Member

Node.js 13 又改了 require 的行为,之前是 require 同目录下的 js 文件时,package.jsonmain 字段会出错,现在的行为成了,只要有一个不合规范的 package.json 就会报错。

image

@luckyadam 我觉得我们需要考虑一套新的模版机制,你觉得呢

这样子,那还挺蛋疼的,看来模板机制确实得换了,有啥建议不~

@kamicloud
Copy link

+1

Happened on node13 and taro 2.0.1

Chen-jj added a commit that referenced this issue Jan 19, 2020
兼容 Nodejs 13+ 调用 require 时 package.json 格式不能非法
@taro-bot
Copy link

taro-bot bot commented Jan 19, 2020

Hello~

您的问题楼上已经提供了解决方案,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

jiangzm pushed a commit to jiangzm/taro that referenced this issue Dec 7, 2020
兼容 Nodejs 13+ 调用 require 时 package.json 格式不能非法
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants