nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
669 stars 170 forks source link

Problem building on windows #912

Open Oeffner opened 2 years ago

Oeffner commented 2 years ago

I am embarking on a new project that will use NGL. I have very little experience using node and npm for building. I seem to have problems building NGL on Windows10 from sources. It works fine on Linux (WSL Ubuntu with native linux build tools).

For Windows 10 I issue the commands: npm ci npm run build

The last command stops with the following error:

src/ngl.ts → dist/ngl.umd.js, dist/ngl.esm.js... [!] (plugin buble) SyntaxError: Unexpected token (219:13) A:\OeffnerStuff\Work\NGLsource\ngl\src\ngl.ts (219:13) 215 : // 216 : 217 : import Version from './version' 218 : 219 : if (!(window as any).Promise) { ^ SyntaxError: Unexpected token (219:13) at Object.pp$4.raise (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2825:15) at Object.pp.unexpected (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:689:10) at Object.pp.expect (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:683:28) at Object.pp$3.parseParenAndDistinguishExpression (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2311:38) at Object.pp$3.parseExprAtom (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2230:43) at Object.parseExprAtom (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn-dynamic-import\lib\index.js:75:117) at Object.parseExprAtom (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn-jsx\index.js:445:22) at Object.pp$3.parseExprSubscripts (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2089:21) at Object.pp$3.parseMaybeUnary (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2066:19) at Object.pp$3.parseMaybeUnary (A:\OeffnerStuff\Work\NGLsource\ngl\node_modules\acorn\dist\acorn.js:2057:28)

C:\Users\Oeffner\OeffnerStuff\Work\NGLsource\ngl>

Building on Linux works fine although there are a few warnings about circular dependencies. I guess I can live with only being able to build witth Linux tools but it would be good to have to problem fixed on windows

The versions I'm using are the same on both Windows and linux:

oeffner@Dirac:~/NGLbuild/ngl$ node -v v16.13.2 oeffner@Dirac:~/NGLbuild/ngl$ npm -v 8.1.2 oeffner@Dirac:~/NGLbuild/ngl$ git log -n 1 commit 74795371a3990e9c9d55560af1583ead99b95172 (HEAD -> master, origin/master, origin/HEAD) Merge: a8770ad0 53f5574a Author: Paul Pillot <paulpillot@gmail.com> Date: Sun Jan 23 16:28:30 2022 -0500

If anyone has an idea of why I can't build on windows that would be great to learn. Many thanks