parcel-bundler/parcel

Cannot read property 'posthtml' of undefined

Closed this issue ยท 14 comments

Following the tutorial on https://parceljs.org/ I get the following error when I run parcel index.html.

โฏ parcel index.html
Server running at http://localhost:1234
๐Ÿšจ  /Users/foo/Desktop/parcel-app/index.html: Cannot read property 'posthtml' of undefined
    at /Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:5:31
    at Generator.next (<anonymous>)
    at step (/Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:26:191)
    at /Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:26:437
    at /Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:26:99
    at getConfig (/Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:22:18)
    at /Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:35:24
    at Generator.next (<anonymous>)
    at step (/Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:26:191)
    at /Users/foo/.nvm/versions/node/v7.6.0/lib/node_modules/parcel-bundler/lib/transforms/posthtml.js:26:437

Ah it's because there is no package.json in your project. I will fix.

I ran into the same thing while following the getting started page.

I recommend making more explicit instructions on that page. I've submitted a PR with my suggestion for doing that. parcel-bundler/website#4

After adding a package.json I'm now hitting #1

Getting closer though! ๐Ÿ˜„

Published v1.0.1 which should fix both issues.

Just installed 1.0.1, now i'm getting: Couldn't find preset "env" relative to directory "/Users/robdodson/.nvm/versions/node/v8.9.1/lib/node_modules/parcel-bundler/src"

blargh. did you create a .babelrc but forget to install babel-preset-env in your project?

Is that in the documentation somewhere?

I just followed the tutorial on the front page, it didn't mention needing a .babelrc :)

hmm, you shouldn't need a babelrc for that. I tried the code from the homepage just now and it seemed to work for me... i'll look into it more.

I have the same issue as above when following the getting started tutorial. The issue occurs when importing the css file.

same issues here when attempting to import css or scss. /usr/local/lib/node_modules/parcel-bundler/src/builtins/css-loader.js: Couldn't find preset "env" relative to directory "/usr/local/lib/node_modules/parcel-bundler/src"

These issues should both be fixed in v1.0.2.

Using 1.9.0, if the package.json isn't there, you get the error:

/Users/chriszrc/github/proj-ticker/web/index.html: Cannot read property 'posthtml' of null
    at getConfig (/Users/chriszrc/.npm-global/lib/node_modules/parcel-bundler/src/transforms/posthtml.js:29:32)
    at <anonymous>

People/I should read the docs more carefully, but it might be nice to have a better error message here-