indie-stack icon indicating copy to clipboard operation
indie-stack copied to clipboard

JavaScript version fails when generating a seed for Prisma (on macOS 12.6 Intel)

Open OllyHodgson opened this issue 3 years ago • 1 comments
trafficstars

Have you experienced this bug with the latest version of the template?

Yes

Steps to Reproduce

On macOS 12.6 Intel:

  1. npx create-remix@latest --template remix-run/indie-stack remix-experiment-2
  2. ? TypeScript or JavaScript? JavaScript
  3. ? Do you want me to run npm install? Yes

Expected Behavior

The script completes successfully.

Actual Behavior

The remix.init script fails when generating a seed:

Running seed command `node --require tsconfig-paths/register prisma/seed.js` ...
TypeError: Cannot read properties of undefined (reading 'hash')
    at seed (/Users/ohodgson/inunison/repos/iu-remix-experiment/remix-experiment-2/prisma/seed.js:15:39)

An error occured while running the seed command:
Error: Command failed with exit code 1: node --require tsconfig-paths/register prisma/seed.js
🚨 Oops, remix.init failed

Command failed: npm run setup 

Note: If I choose TypeScript at step 2 the script runs correctly.

OllyHodgson avatar Oct 07 '22 01:10 OllyHodgson

I'm running into excactly the same issue, hence I'm using mac os 12.6 with M1.

Solved it by changing seed.js

const { PrismaClient } = require("@prisma/client");

- const bcrypt = require("bcryptjs").default;
+ const bcrypt = require("bcryptjs");

const prisma = new PrismaClient();

christoph-kluge avatar Oct 10 '22 20:10 christoph-kluge

the same issue, when i do npm run dev . i get in my browser TypeError: invariant is not a function at app/session.server.js (C:\Users\A\Desktop\myReact\blog-tutorial\app\session.server.js:7:1) at C:\Users\A\Desktop\myReact\blog-tutorial\build\index.js:6:56 at Object. (C:\Users\A\Desktop\myReact\blog-tutorial\app\root.jsx:14:21) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at C:\Users\A\Desktop\myReact\blog-tutorial\node_modules@remix-run\serve\dist\index.js:43:17 at Layer.handle [as handle_request] (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\route.js:144:13) at next (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\route.js:140:7) at next (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\route.js:140:7) at next (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\route.js:140:7) at next (C:\Users\A\Desktop\myReact\blog-tutorial\node_modules\express\lib\router\route.js:140:7)

dophaminum avatar Nov 01 '22 16:11 dophaminum

I just ran into this on an m1, macOS 12.6 (21G115), nodejs 19.0.0, but ONLY when selecting Javascript at the first prompt. If I select typescript, it installs 👍

      
All migrations have been successfully applied.
Environment variables loaded from .env
Running seed command `node --require tsconfig-paths/register prisma/seed.js` ...
TypeError: Cannot read properties of undefined (reading 'hash')
    at seed (/Users/ericbrookfield/test/blog-tutorial/prisma/seed.js:14:39)

An error occurred while running the seed command:
Error: Command failed with exit code 1: node --require tsconfig-paths/register prisma/seed.js
🚨 Oops, remix.init failed

ericdfields avatar Nov 03 '22 13:11 ericdfields

@MichaelDeBoey seems to be the same as https://github.com/remix-run/remix/issues/4467 👀

machour avatar Nov 03 '22 13:11 machour

Faced with te same error today when trying to do

npx create-remix@latest --template remix-run/indie-stack blog-tutorial
? TypeScript or JavaScript? JavaScript
? Do you want me to run `npm install`? Yes
⠙ Migrating template to JavaScript…Processing 10 files... 

got this error

Running seed command `node --require tsconfig-paths/register prisma/seed.js` ...
TypeError: Cannot read properties of undefined (reading 'hash')
    at seed (/home/dmitry/Downloads/blog-tutorial/prisma/seed.js:14:39)

An error occurred while running the seed command:
Error: Command failed with exit code 1: node --require tsconfig-paths/register prisma/seed.js
🚨 Oops, remix.init failed

DmitryOb avatar Jan 13 '23 09:01 DmitryOb

Fixed by remix-run/remix#5163.

For more detail on the approach taken, see the decision doc for JS conversion support

pcattori avatar Jan 21 '23 05:01 pcattori