Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Unexpected token { during build when updating from v3.0.0-beta.18 to v3.0.0-beta.19 #363

Closed
kharrak opened this issue Feb 4, 2017 · 3 comments

Comments

@kharrak
Copy link

kharrak commented Feb 4, 2017

It's the first time I'm opening an issue and I'm sorry if it's the wrong place or time :).

I updated from v3.0.0-beta.18 to v3.0.0-beta.19 and during build an error popped and the build clearly stopped. I've compared the dependencies of these two versions and you can see them below.
I've downgraded to beta.18 and now build is passing.

I'm using typescript loader along with webpack 2.2.0 and node 6.9.1
I can provide further details of my configuration for whom it may concern.

I've deleted node_modules, cleared npm cache and I'm getting almost the same stacktrack trace as down below:
Could not find 'lib/plugins.js' .....

Is it because of the nodejs version?

The differences are
`[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
-- [email protected]

| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| -- [email protected]
| +-- [email protected]
| +-- [email protected]
-- [email protected]`

Original stack trace.
SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (D:\Dev\src\node_modules\awesome-typescript-loader\src\entry.ts:2:18) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (D:\Dev\src\config\webpack.common.js:17:23) at Module._compile (module.js:409:26)

My tsconfig looks like this
{ "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "sourceMap": true, "noEmit": false, "noEmitHelpers": true, "strictNullChecks": false, "skipDefaultLibCheck": true, "lib": [ "dom", "es6" ], "typeRoots": [ "node_modules/@types" ], "types": [ "hammerjs", "jasmine", "node", "source-map", "uglify-js", "webpack" ] }, "exclude": [ "node_modules", "wwwroot/dist" ], "awesomeTypescriptLoaderOptions": { "forkChecker": true, "useWebpackText": true }, "compileOnSave": false, "buildOnSave": false, "atom": { "rewriteTsconfig": false } }

@s-panferov
Copy link
Owner

s-panferov commented Feb 4, 2017

Could not find 'lib/plugins.js' .....

Could you please provide the whole stacktrace?

@kharrak
Copy link
Author

kharrak commented Feb 4, 2017

Hello,
The log with lib/plugin.js was showing on my local machine and unfortunately the npm log vanished.
I've changed it back to beta.19 and I have a clean build on my local machine (node_modules cleaned/npm cache cleaned).

I'm using a build machine for production builds and on that one the error is still reproducing for beta.19 (the last stacktrace from above).

I think this is a node problem because on my build machine node version is v4.4.3.

On the build machine I don't have rights to change it to 6.9.3 so I will downgrade node to 4.4.3 on my local machine to see if it's reproducing and come back asap
I can only assume the lib/plugin.js error was popping due to some npm cache problems.

Edit:
Downgraded to node 4.4.3 on local machine and the 'Unexpected token { ' stack trace is showing.
So from my point of view it has something to do with node v 4.4.3.

@cvillamor
Copy link

cvillamor commented Feb 4, 2017

Encountered this error as well. Was working on my local version of node but not on the version of node on our ci server.

Here is a copy of the stack trace from the failed build on our CI Server:

ERROR in ./src/polyfills.ts
Module build failed: SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/ubuntu/surveyor/platform/node_modules/awesome-typescript-loader/src/entry.ts:2:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at loadLoader (/home/ubuntu/surveyor/platform/node_modules/loader-runner/lib/loadLoader.js:13:17)
at iteratePitchingLoaders (/home/ubuntu/surveyor/platform/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at runLoaders (/home/ubuntu/surveyor/platform/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
at NormalModule.doBuild (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModule.js:129:2)
at NormalModule.build (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModule.js:180:15)
at Compilation.buildModule (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/Compilation.js:127:10)
at /home/ubuntu/surveyor/platform/node_modules/webpack/lib/Compilation.js:404:9
at /home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModuleFactory.js:242:4
at /home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModuleFactory.js:93:13
at /home/ubuntu/surveyor/platform/node_modules/tapable/lib/Tapable.js:204:11
at NormalModuleFactory. (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/CompatibilityPlugin.js:51:4)
at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/ubuntu/surveyor/platform/node_modules/tapable/lib/Tapable.js:208:13)
at onDoneResolving (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModuleFactory.js:68:11)
at onDoneResolving (/home/ubuntu/surveyor/platform/node_modules/webpack/lib/NormalModuleFactory.js:189:6)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)

Our CI server is on Node version v4.2.6

Note I have fixed this by downgrading to 3.0.0-beta.18

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants