Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Error triggered on some files (.md, .npmignore, LICENCE) #75

Closed
jbdemonte opened this issue May 6, 2017 · 9 comments
Closed

Error triggered on some files (.md, .npmignore, LICENCE) #75

jbdemonte opened this issue May 6, 2017 · 9 comments

Comments

@jbdemonte
Copy link

Trying to pack a project which includes jade (pug), these errors are triggered:

Error! Unexpected token (16:0)
../node_modules/jade/.npmignore
Error! Unexpected token (1:4)
../node_modules/jade/History.md
Error! Unexpected token (1:5)
../node_modules/jade/LICENSE

Build cmd: pkg package.json --options expose-gc --targets node7-linux-armv7 --out-dir build

jade dependency in package.json: "jade": "^1.11.0",

@igorklopov
Copy link
Contributor

Hi! I failed to reproduce. Seems that you add scripts entry somewhere. Can you post full package.json? Or even better minimal example with all files to reproduce.

@jbdemonte
Copy link
Author

Same project as in the other issue: https://github.com/jbdemonte/Retro-Manager

@igorklopov
Copy link
Contributor

Please upgrade to pkg@3.0.4 and try again

@carrotalan
Copy link

carrotalan commented Oct 11, 2017

This is still an issue. Getting unexpected token when including pouchdb-fauxton in my project.

Command ran is:
pkg app.js --targets node6.11.2-linux-x64

I have tried also with and without this in my package.json file:

"pkg": {
"scripts": "node_modules/pouchdb-fauxton/www/*.js",
"assets": "node_modules/pouchdb-fauxton/www/index.html"
}

Output is:

> Error! Unexpected token (14:0)
  /Volumes/Data/Users/work/git/kiosk-platform/kiosk-site-api/node_modules/pouchdb-fauxton/www/index.html

Only temporary relief is to "minify" the HTML file using something like this: https://www.willpeavy.com/minifier/

@dotarmin
Copy link

dotarmin commented May 9, 2018

I get same error as @carrotalan when including pouchdb-fauxton, any update on this or is there any work around?

Thanks!

/Armin

@motin
Copy link

motin commented Oct 18, 2018

Had the same issue with pouchdb-fauxton:

> Error! Unexpected token (14:0)
  /Users/motin/Dev/Projects/sq/sq-project/tools/clerk-cli/node_modules/pouchdb-fauxton/www/index.html

However, since I am certain that I am not using pouchdb-fauxton (which is just an optional web frontend), a workaround is to remove the node_modules/pouchdb-fauxton folder before running pkg.

@tomachinz
Copy link

I see this while trying to use the library vue-golden-layout

> pkg@4.3.4
> Error! Unexpected token (1:0)
  /Users/tom/Github/vue-golden-layout/node_modules/golden-layout/src/css/goldenlayout-base.css

@zhengxiaoyao0716
Copy link

zhengxiaoyao0716 commented Sep 26, 2019

It seems that pkg try to resolved non-javascript files (like .css) as javascript files and caused this problem.
For me, this just happend if the entrypoint was package.json or the project path, when I use the .js file as entrypoint, everything works well (but with no assets bundled). I have two speculations for that:

  1. maybe the pkg ignored all the non-javascript files when we use .js file as entrypoint, but not ignored them when we used package.json. Third-packages has their own assets files, what we expected is just to copied those non-javascript files into bundled package.
  2. maybe pkg always ignored those non-js files, but when we use package.json or project path as entrypoint, pkg just try to bundle all the dependencies defined in the package.json, but when we used .js file, it would try to resolved the correctly dependencies that really used in the entrypoint files, so the third-package with non-js files has never be resolved.

@wb670
Copy link

wb670 commented Nov 9, 2021

I see this while trying to use the library pm2

> pkg@5.3.0
> Error! Unexpected token (3:0)
  /var/www/dotd/node_modules/pm2-deploy/deploy

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

8 participants