micheleriva / multitenant-nextjs

a test repository for testing Next.js' multi-tenant capabilities with a custom Express.js server
14 stars 2 forks source link

/bin/sh: index.js: command not found #1

Closed philharmonie closed 2 years ago

philharmonie commented 2 years ago

After running yarn dev I get:

yarn dev        
yarn run v1.22.4
$ NODE_ENV=development index.js
/bin/sh: index.js: command not found
error Command failed with exit code 127.0
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And when I change the dev command to next dev I get:

ready - started server on http://localhost:3000
event - compiled successfully

what Is fine, but when I access http://local.website-1.com:3000 I get:

event - build page: /next/dist/pages/_error
wait  - compiling...
event - compiled successfully
TypeError: Assignment to constant variable.
    at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.js:94:15)
    at async loadGetInitialProps (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/lib/utils.js:5:91)
    at async renderToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/render.js:25:1353)
    at async /Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:99:97
    at async /Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:92:142
    at async DevServer.renderToHTMLWithComponents (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:124:387)
    at async DevServer.renderErrorToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:126:327)
    at async DevServer.renderErrorToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/server/next-dev-server.js:34:1204)
    at async DevServer.renderError (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:125:1543)
TypeError: Assignment to constant variable.
    at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.js:94:15)
    at async loadGetInitialProps (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/lib/utils.js:5:91)
    at async renderToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/render.js:25:1353)
    at async /Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:99:97
    at async /Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:92:142
    at async DevServer.renderToHTMLWithComponents (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:124:387)
    at async DevServer.renderErrorToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:126:327)
    at async DevServer.renderErrorToHTML (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/server/next-dev-server.js:34:1204)
    at async DevServer.renderError (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:125:1543)
    at async DevServer.run (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:66:1232)
    at async DevServer.handleRequest (/Users/user/Desktop/multitenant-nextjs/node_modules/next/dist/next-server/server/next-server.js:34:1081)
micheleriva commented 2 years ago

Hi @philharmonie ! Please try using https://github.com/micheleriva/krabs. It's a more advanced library for dealing with multi-tenancy with Next.js 🙂