Reputation: 13
run yarn build
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
"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-scripts build Creating an optimized production build... Failed to compile. Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Upvotes: 1
Views: 168
Reputation: 48
From my experience, I had the same issue and realized that it was because the dependency versions have updated beyond the yarn.lock
file dependency versions. So when I would delete the yarn.lock file and do yarn install
, a new yarn.lock
file was created with the new dependency versions and gave me the same error:
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'
Make sure to reclone the template project from Github and don't delete the yarn.lock
file to keep the old versions. Eventually you have to get around updating the versions to make it work, but temporarily if you wanna just play around with substrate and react frontend.
Upvotes: 1