Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Error: Unexpected identifier #72

Open
mulikaminker opened this issue Feb 20, 2018 · 8 comments
Open

Error: Unexpected identifier #72

mulikaminker opened this issue Feb 20, 2018 · 8 comments

Comments

@mulikaminker
Copy link

node -v: 7.10.1
npm: 4.2.0.
The error happened wane i run "npm run dev".
yntaxError: Unexpected identifier at Object.<anonymous> (/node_modules/next-auth/client.js:98:1) at __webpack_require__ (/node_modules/next-auth/client.js:30:30)

@iaincollins
Copy link
Owner

Thanks for the bug report. It should work fine with that version of node and npm - I have tried with those exact versions, and that's what is used in production for the demo.

There was similar issue reported recently but was down to node 6.

If you have recently upgraded node you can try npm rebuild to update any modules for node 7.

A more drastic solution is just to rm -rf node_modules then run npm install again.

If neither of those work I can try to replicate if you let me know your operating system and the full error from the console (if there is anything more).

@iaincollins
Copy link
Owner

I'm going to close this, but feel free to reopen / comment if you experience the same problem.

Please include as much information as possible.

@mulikaminker
Copy link
Author

The problem is probably related to the NextAuth node modules. I turned the NextAuth into a local component and now it works

@iaincollins
Copy link
Owner

Thanks for the update.

To confirm for anyone reading, there are currently no known related issues with the NextAuth module (including with the specific version of node+npm), and doing this shouldn't be necessary (and if you see this it's a bug and please do report it - here or in a separate issue).

It sounds like something specific to the local instance - maybe a conflict with some custom webpack configuration or platform specific? Unfortunately without more information I can't tell.

If anyone has any issues please do link to a repo and/or include debug information as if there is something odd going on I'd like to get to the bottom of it.

@deejaygeroso
Copy link

deejaygeroso commented Mar 16, 2018

hello there @iaincollins, I'm currently having the same problem but I don't know if its related
I have node v8.9.4 on Ubuntu 14.04LTS
npm -v 5.6.0

this is the full error:


main.js:5698 Unexpected identifier
SyntaxError: Unexpected identifier
    at Object.<anonymous> (http://localhost:3000/_next/-/page/index.js:6826:1)
    at __webpack_require__ (http://localhost:3000/_next/-/page/index.js:6758:30)
    at eval (webpack-internal:///0:2:76)
    at Object.<anonymous> (http://localhost:3000/_next/-/page/index.js:6814:1)
    at __webpack_require__ (http://localhost:3000/_next/-/page/index.js:6758:30)
    at http://localhost:3000/_next/-/page/index.js:6801:18
    at http://localhost:3000/_next/-/page/index.js:6804:10
    at webpackUniversalModuleDefinition (http://localhost:3000/_next/-/page/index.js:6731:20)
    at Object.webpackJsonp../node_modules/next-auth/client.js (http://localhost:3000/_next/-/page/index.js:6738:3)
    at __webpack_require__ (http://localhost:3000/_next/-/manifest.js:715:31)

@sebastiangrebe
Copy link

I have got the same problems. I am using Windows with node 7.4.0.

Here a screenshot of the problem.

error

@iaincollins
Copy link
Owner

@deejaygeroso @Sebi55 Thanks both for the detailed reports, will investigate!

@iaincollins
Copy link
Owner

I've just confirmed it still works on both node 7.x and node 8.x on both Ubuntu and Mac from a fresh clone of the repo with just npm install and then npm run dev.

This was using the latest LTS versions of both node and fresh install of Ubuntu (and in the case of Mac OS X, High Sierra 10.13.4):

$ node --version
v8.11.1
$ npm --version
5.6.0
$ cat /etc/issue
Ubuntu 16.0.4.4 LTS 

This is running on x86 (64-bit), though I assume just about everyone is at this point - as not many folks running 32-bit or non intel architecture, etc. these days.

I'm not sure what would cause an error on Ubuntu 14 LTS and/or with earlier versions of node. Having something like webpack or babel installed globally might possibly mess with things. Several getting starting guides recommend that, but it can cause problems.

If a previous version of node was installed and used to run the project - or to install the modules - then you might even want to clear out the project's ./node_modules/ directory.

Using n to install a good copy of the latest LTS version of node (e.g. sudo npm -g install n && sudo n lts) might help if node has been installed some other way and might be funky.

For Windows (cc @Sebi55):

Windows is a bit of a special case. Other users are running it on Windows but I'm currently travelling and don't have a local Windows instance to hand to verify it still builds fine on Windows myself. It used to build fine, and it still should, but I haven't actually tried it in a while.

For now I can only suggest maybe running a Linux (e.g. Ubuntu) Virtual Machine, as in practice it can make running node apps a lot easier than running them on Windows.

@iaincollins iaincollins reopened this Apr 2, 2018
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

4 participants