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

[Bug]: During postinstall, "remix is not recognized as a command" error #1233

Closed
skitterm opened this issue Dec 24, 2021 · 5 comments
Closed

Comments

@skitterm
Copy link

skitterm commented Dec 24, 2021

What version of Remix are you using?

1.1.1

What version of Node are you using? Minimum supported version is 14.

17.3.0

Steps to Reproduce

When attempting to setup a project as part of the Blog tutorial instructions, things fail on the postinstall step, preventing me from continuing on with the project.

To reproduce:

  1. Run npx create-remix@latest
  2. Make the following choices:
? Where would you like to create your app? ./my-remix-app
? Where do you want to deploy? Choose Remix if you're unsure, it's easy to change deployment targets. Remix App Server     
? TypeScript or JavaScript? TypeScript
? Do you want me to run `npm install`? Yes
  1. Observe that the command fails (on the postinstall step by the looks of it), with the following error:
'remix' is not recognized as an internal or external command,
operable program or batch file

I'm on Windows 10, build 19043.1415. I'm wondering if this is OS/OS-version-specific since no-one else has run across the same issue.

I also tried using v1.0.6 instead, but same result.

Expected Behavior

The postinstall script should run successfully.

Actual Behavior

The npx create-remix command fails. Full console error below:

$ npx create-remix@latest

R E M I X

💿 Welcome to Remix! Let's get you set up with a new project.

? Where would you like to create your app? ./my-remix-app
? Where do you want to deploy? Choose Remix if you're unsure, it's easy to change deployment targets. Remix App Server
? TypeScript or JavaScript? TypeScript       
? Do you want me to run `npm install`? Yes

> postinstall
> remix setup node

'remix' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Users\<path-to-the-project>\my-remix-app
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c remix setup node

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<username>\AppData\Local\npm-cache\_logs\2021-12-24T20_32_23_844Z-debug-0.log
Error: Command failed: npm install
    at checkExecSyncError (node:child_process:826:11)
    at Object.execSync (node:child_process:900:15)
    at run (C:\Users\curly\AppData\Local\npm-cache\_npx\5164864a48bff686\node_modules\create-remix\cli.js:205:19) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 2968,
  stdout: null,
  stderr: null
}
@skitterm skitterm added the bug Something isn't working label Dec 24, 2021
@luffy84217
Copy link

@skitterm Could you provide the version of npm? I'm on Windows 10 Home, build 19042.1415, and using version of node 17.3.0 the same but cannot reproduce.

@skitterm
Copy link
Author

@luffy84217 thanks for reaching out. I'm on NPM v8.3.0.

@luffy84217
Copy link

luffy84217 commented Dec 30, 2021

@skitterm Have you ever tried running npm cache clean --force before running npx create-remix@latest? If it doesn't work, I think you should inspect my-remix-app/node_modules/.bin/remix.cmd and Windows System to check environment variables... (choose "no" and remove script postinstall in package.json then npm install manually after cli asks you "Do you want me to run npm install?")

@ssisk
Copy link

ssisk commented Jan 4, 2022

I ran into a similar error ('remix: not found') when docker-izing a remix express app. I haven't run into the issue outside of docker (I'm running on MacOs)

The solution I found was to move the @remix-run/dev entry in package.json from devDependencies over into dependencies

https://github.com/ssisk/create-remix-docker has a repro of the issue (see debug-notes.md for a bit more discussion of how I set the repro up and what else I tried)

@mabadir
Copy link

mabadir commented Jan 26, 2022

I am having the same issue, and I think the issue is related to having this postInstall command:
"postinstall": "remix setup node"
This command depends on @remix-run/dev which is a devDependency.

So basically running install command with production flag removes remix cli, and the postInstall command fails.

I hope that helps.

For the time being, for those impacted, moving @remix-run/dev as a production dependency is probably going to fix that. Not sure if the remix team has any thoughts about that, if that will pose any security concerns.

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

No branches or pull requests

6 participants