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

BabelLoader unexpected token #36

Open
jakobfriis opened this issue Jan 13, 2022 · 4 comments
Open

BabelLoader unexpected token #36

jakobfriis opened this issue Jan 13, 2022 · 4 comments

Comments

@jakobfriis
Copy link

Using yarn on Ubuntu, with the supplied package.json, there seems to be a problem with the setup

jfr@dockerhost:~/docker/notica.dk$ yarn start --host 0.0.0.0
yarn run v1.22.17
$ yarn run build && node server.js --host 0.0.0.0
$ webpack --config ./webpack.production.config.js --profile --display-error-details --no-color
Hash: 0c34ed32dc97cdb5d755
Version: webpack 1.15.0
Time: 593ms
[0] multi main 28 bytes {0} [built] [1 error]
factory:0ms building:1ms = 1ms
+ 1 hidden modules

ERROR in ./src/index.js
Module build failed: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

BabelLoaderError: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

at transpile (/home/jfr/docker/notica.dk/node_modules/babel-loader/lib/index.js:61:13)
at Object.module.exports (/home/jfr/docker/notica.dk/node_modules/babel-loader/lib/index.js:163:20)

@ multi main
==> Listening on port 3000. Open up http://0.0.0.0:3000/ in your browser.

Any ideas ? The page is blank, when opening it.

@tannercollin
Copy link
Owner

This is strange. I wonder if it's because of different yarn / node versions?

I wrote it on yarn v1.17.3 and node v10.24.1. Can you try those versions?

@jakobfriis
Copy link
Author

Thanks for the reply. Unfortunately it does not help.

npm version
{ Notica: '1.2.0',
npm: '6.14.12',
ares: '1.15.0',
brotli: '1.0.7',
cldr: '35.1',
http_parser: '2.9.4',
icu: '64.2',
modules: '64',
napi: '7',
nghttp2: '1.41.0',
node: '10.24.1',
openssl: '1.1.1k',
tz: '2019c',
unicode: '12.1',
uv: '1.34.2',
v8: '6.8.275.32-node.59',
zlib: '1.2.11' }

yarn install && yarn start --host 0.0.0.0
yarn install v1.17.3
warning package-lock.json found. Your project contains lock files generated by t ools other than Yarn. It is advised not to mix package managers in order to avoi d resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.76s.
yarn run v1.17.3
$ yarn run build && node server.js --host 0.0.0.0
$ webpack --config ./webpack.production.config.js --profile --display-error-deta ils --no-color
Hash: 0c34ed32dc97cdb5d755
Version: webpack 1.15.0
Time: 564ms
[0] multi main 28 bytes {0} [built] [1 error]
factory:0ms building:1ms = 1ms
+ 1 hidden modules

ERROR in ./src/index.js
Module build failed: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

BabelLoaderError: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

at transpile (/home/jfr/docker/notica.dk/node_modules/babel-loader/lib/index                                   .js:61:13)
at Object.module.exports (/home/jfr/docker/notica.dk/node_modules/babel-load                                   er/lib/index.js:163:20)

@ multi main
==> Listening on port 3000. Open up http://0.0.0.0:3000/ in your browser.

@tannercollin
Copy link
Owner

It works perfectly first try for me:

[Thu Jan 20 05:07 PM] tanner@tannerlaptop:~/work
└─► git clone [email protected]:tannercollin/Notica.git
Cloning into 'Notica'...
Warning: Permanently added the RSA host key for IP address '140.82.112.3' to the list of known hosts.
Enter passphrase for key '/home/tanner/.ssh/id_ed25519': 
remote: Enumerating objects: 476, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 476 (delta 46), reused 28 (delta 10), pack-reused 384
Receiving objects: 100% (476/476), 484.09 KiB | 1.59 MiB/s, done.
Resolving deltas: 100% (245/245), done.
[Thu Jan 20 05:07 PM] tanner@tannerlaptop:~/work
└─► cd Notica
[Thu Jan 20 05:08 PM] tanner@tannerlaptop:~/work/Notica
└─► yarn install
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@>=0.8.0 || ~1.0.0-rc-0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.17", while you're on "1.22.4".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Done in 3.29s.
[Thu Jan 20 05:08 PM] tanner@tannerlaptop:~/work/Notica
└─► yarn start
yarn run v1.22.4
$ yarn run build && node server.js
$ webpack --config ./webpack.production.config.js --profile --display-error-details --no-color
Hash: d6d501cab2425711abd9
Version: webpack 1.15.0
Time: 3888ms
        Asset       Size  Chunks             Chunk Names
    bundle.js     285 kB       0  [emitted]  main
bundle.js.map  177 bytes       0  [emitted]  main
   [0] multi main 28 bytes {0} [built]
       factory:0ms building:0ms = 0ms
    + 292 hidden modules
==> Listening on port 3000. Open up http://127.0.0.1:3000/ in your browser.
2022-01-20T17:11:14-07:00: New connection from 127.0.0.1
2022-01-20T17:11:14-07:00: New connection joining room: pOZlMw

This is strange. Can you do git diff or something to see if any of the files changed?

@tannercollin
Copy link
Owner

Try checking it out to a different directory and following the exact steps again.

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

2 participants