Error triggered on some files (.md, .npmignore, LICENCE)
jbdemonte opened this issue · 9 comments
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",
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.
Same project as in the other issue: https://github.com/jbdemonte/Retro-Manager
Please upgrade to pkg@3.0.4
and try again
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/
I get same error as @carrotalan when including pouchdb-fauxton, any update on this or is there any work around?
Thanks!
/Armin
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.
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
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:
- maybe the
pkg
ignored all the non-javascript files when we use.js
file as entrypoint, but not ignored them when we usedpackage.json
. Third-packages has their own assets files, what we expected is just to copied those non-javascript files into bundled package. - maybe
pkg
always ignored those non-js files, but when we usepackage.json
or project path as entrypoint,pkg
just try to bundle all the dependencies defined in thepackage.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.
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