Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'posthtml' of undefined #2

Closed
robdodson opened this issue Dec 5, 2017 · 14 comments
Closed

Cannot read property 'posthtml' of undefined #2

robdodson opened this issue Dec 5, 2017 · 14 comments

Comments

@robdodson
Copy link

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
@devongovett
Copy link
Member

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

@trafnar
Copy link

trafnar commented Dec 5, 2017

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

@robdodson
Copy link
Author

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

Getting closer though! 😄

@devongovett
Copy link
Member

Published v1.0.1 which should fix both issues.

@robdodson
Copy link
Author

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"

@devongovett
Copy link
Member

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

@jaruesink
Copy link

Is that in the documentation somewhere?

@devongovett
Copy link
Member

@robdodson
Copy link
Author

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

@devongovett devongovett reopened this Dec 5, 2017
@devongovett
Copy link
Member

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.

@Jayphen
Copy link

Jayphen commented Dec 5, 2017

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

@thomaslittle
Copy link

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"

@devongovett
Copy link
Member

These issues should both be fixed in v1.0.2.

@chriszrc
Copy link

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-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants