首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >substrate-developer-hub/substrate-front-end-template跑纱误差

substrate-developer-hub/substrate-front-end-template跑纱误差
EN

Stack Overflow用户
提问于 2022-01-17 15:00:41
回答 1查看 124关注 0票数 1

运行成纱

代码语言:javascript
复制
yarn run v1.22.17
$ react-scripts build
Creating an optimized production build...
Failed to compile.

./node_modules/@polkadot/api/node_modules/@polkadot/keyring/packageInfo.js 6:27
Module parse failed: Unexpected token (6:27)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export var packageInfo = {
|   name: '@polkadot/keyring',
>   path: new URL('.', import.meta.url).pathname,
|   type: 'esm',
|   version: '8.3.2'


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

package.json

代码语言:javascript
复制
"dependencies": {
    "@polkadot/api": "^6.7.2",
    "@polkadot/extension-dapp": "^0.41.1",
    "@polkadot/keyring": "^7.8.2",
    "@polkadot/networks": "^7.8.2",
    "@polkadot/types": "^6.7.2",
    "@polkadot/ui-keyring": "^0.86.5",
    "@polkadot/ui-settings": "^0.86.5",
    "@polkadot/util": "^7.8.2",
    "@polkadot/util-crypto": "^7.8.2",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "prop-types": "^15.7.2",
    "query-string": "^7.0.1",
    "react": "^17.0.2",
    "react-copy-to-clipboard": "^5.0.4",
    "react-dom": "^17.0.2",
    "react-scripts": "^4.0.3",
    "web-vitals": "^2.1.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

$react脚本构建创建一个优化的生产构建..。编译失败。命令失败,退出代码1.info访问https://yarnpkg.com/en/docs/cli/run获取有关此命令的文档。

EN

回答 1

Stack Overflow用户

发布于 2022-01-17 17:24:48

根据我的经验,我也遇到了同样的问题,并意识到这是因为依赖关系版本已经更新了yarn.lock文件依赖版本之外的版本。因此,当我删除yarn.lock文件并执行yarn install时,使用新的依赖项版本创建了一个新的yarn.lock文件,并给出了相同的错误:

代码语言:javascript
复制
Creating an optimized production build...
Failed to compile.

./node_modules/@polkadot/api/node_modules/@polkadot/keyring/packageInfo.js 6:27
Module parse failed: Unexpected token (6:27)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export var packageInfo = {
|   name: '@polkadot/keyring',
>   path: new URL('.', import.meta.url).pathname,
|   type: 'esm',
|   version: '8.3.2'

请确保从Github重新克隆模板项目,不要删除yarn.lock文件以保留旧版本。最终,你必须围绕更新版本,使其工作,但暂时,如果你只想玩周围的基板和反应前端。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70743408

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档