ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
851 stars 160 forks source link

TypeError: Path must be a string. Received undefined #522

Open devdemi opened 7 years ago

devdemi commented 7 years ago

I followed steps here https://ember-fastboot.com/docs/deploying#deploying-your-app And after start ember-fastboot /usr/src/fe/dist/ --port 80 I got net error:

path.js:8 throw new TypeError('Path must be a string. Received ' + ^

TypeError: Path must be a string. Received undefined at assertPath (path.js:8:11) at Object.posix.join (path.js:479:5) at readPackageJSON (/usr/local/lib/node_modules/ember-fastboot-server/lib/server.js:177:20) at FastBootServer.buildEmberApp (/usr/local/lib/node_modules/ember-fastboot-server/lib/server.js:39:16) at new FastBootServer (/usr/local/lib/node_modules/ember-fastboot-server/lib/server.js:16:8) at Object. (/usr/local/lib/node_modules/ember-fastboot-server/bin/ember-fastboot:27:14) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12)

There is my dist/package.json which was generated by ember build https://gist.github.com/devdemi/3d3806530a53d8ea81e08f4588e69d83

My versions: node: 4.5.0 npm: 2.15.9 ember-cli: 2.15.0

Please help me to find reason of this error.

cfaester commented 6 years ago

I'd like to excuse myself and bump this issue, as I have the exact same one.

kratiahuja commented 6 years ago

@TheFragen Thank you reporting the issue! Can you mention what version of ember-cli-fastboot and fastboot are you using? if you could share a dummy reproduction that would be great as well.

ankushdharkar commented 6 years ago

@devdemi: Seems like those steps have changed now. If you go to back to that deploy page, it now says:

NOTE: This page is out of date, FastBoot App Server is the current recommended way.

Here is what you can to do instead, to test it locally:

  1. Make a new folder, let's call it Fastboot-Server-My-App
  2. Go to that folder, and run npm i fastboot-app-server --save
  3. Go to your ember app and run ember build --environment production
  4. Copy the entire dist\ folder from the ember app folder into Fastboot-Server-My-App.
  5. Create a file called server.js and put this code inside: [Link] Your folder should end up looking like this:
  6. Now cd into the Fastboot-Server-My-App folder and run this command:PORT=8000 node server.js

If you want to reduce the number of steps, then simply point to the right location of the dist\ folder in distPath in server.js

Enjoy! 😊

rennomarcus commented 6 years ago

I had this problem with fastboot 1.1.0 when I updated to Ember 3.0. I updated to fastboot 1.1.3 and it fixed the problem. I think this fixed the problem: https://github.com/ember-fastboot/ember-cli-fastboot/commit/3a7daca150d841af7c724728145b90151c6cc207