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

Creating a new react app with create-react-app results in Error: Cannot find module 'has-flag' #6097

Closed
2 tasks done
grantspilsbury opened this issue Jan 27, 2023 · 2 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@grantspilsbury
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I am trying to create a new react app. In an empty folder I run npx create-react-app my-app

Which results in the following error:

node:internal/modules/cjs/loader:1042
  throw err;
  ^

Error: Cannot find module 'has-flag'
Require stack:
- /Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/chalk/node_modules/supports-color/index.js
- /Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/chalk/source/index.js
- /Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app/createReactApp.js
- /Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/chalk/node_modules/supports-color/index.js:4:17)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/chalk/node_modules/supports-color/index.js',
    '/Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/chalk/source/index.js',
    '/Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app/createReactApp.js',
    '/Users/gs/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app/index.js'
  ]
}

Node.js v18.13.0

Expected Behavior

No response

Steps To Reproduce

npm: 9.4.0 Node.js: v18.13.0 in an empty folder run npx create-react-app my-app

Environment

  • npm: 9.4.0
  • Node.js: v18.13.0
  • OS Name: MacOS 13.1
  • System Model Name: Macbook pro
  • npm config:
;;;;
; npm userconfig file: /Users/grant.spilsbury/.npmrc
; this is a simple ini-formatted file
; lines that start with semi-colons are comments
; run `npm help 7 config` for documentation of the various options
;
; Configs like `@scope:registry` map a scope to a given registry url.
;
; Configs like `//<hostname>/:_authToken` are auth that is restricted
; to the registry host specified.

registry=https://registry.npmjs.org/

;;;;
; all available options shown below with default values
;;;;


; _auth=null
; access=null
; all=false
; allow-same-version=false
; also=null
; audit=true
; audit-level=null
; auth-type=web
; before=null
; bin-links=true
; browser=null
; ca=null
; cache=~/.npm
; cache-max=null
; cache-min=0
; cafile=null
; call=
; cert=null
; ci-name=null
; cidr=null
; color=true
; commit-hooks=true
; depth=null
; description=true
; dev=false
;
; diff-ignore-all-space=false
; diff-name-only=false
; diff-no-prefix=false
; diff-dst-prefix=b/
; diff-src-prefix=a/
; diff-text=false
; diff-unified=3
; dry-run=false
; editor=nano
; engine-strict=false
; fetch-retries=2
; fetch-retry-factor=10
; fetch-retry-maxtimeout=60000
; fetch-retry-mintimeout=10000
; fetch-timeout=300000
; force=false
; foreground-scripts=false
; format-package-lock=true
; fund=true
; git=git
; git-tag-version=true
; global=false
; globalconfig=
; global-style=false
; heading=npm
; https-proxy=null
; if-present=false
; ignore-scripts=false
;
; include-staged=false
; include-workspace-root=false
; init-author-email=
; init-author-name=
; init-author-url=
; init-license=ISC
; init-module=~/.npm-init.js
; init-version=1.0.0
; init.author.email=
; init.author.name=
; init.author.url=
; init.license=ISC
; init.module=~/.npm-init.js
; init.version=1.0.0
; install-links=true
; install-strategy=hoisted
; json=false
; key=null
; legacy-bundling=false
; legacy-peer-deps=false
; link=false
; local-address=null
; location=user
; lockfile-version=null
; loglevel=notice
; logs-dir=null
; logs-max=10
; long=false
; maxsockets=15
; message=%s
; node-options=null
; noproxy=
; offline=false
;
; omit-lockfile-registry-resolved=false
; only=null
; optional=null
; otp=null
;
; package-lock=true
; package-lock-only=false
; pack-destination=.
; parseable=false
; prefer-offline=false
; prefer-online=false
; prefix=
; preid=
; production=null
; progress=true
; proxy=null
; read-only=false
; rebuild-bundle=true
; registry=https://registry.npmjs.org/
; replace-registry-host=npmjs
; save=true
; save-bundle=false
; save-dev=false
; save-exact=false
; save-optional=false
; save-peer=false
; save-prefix=^
; save-prod=false
; scope=
; script-shell=null
; searchexclude=
; searchlimit=20
; searchopts=
; searchstaleness=900
; shell=/bin/zsh
; shrinkwrap=true
; sign-git-commit=false
; sign-git-tag=false
; strict-peer-deps=false
; strict-ssl=true
; tag=latest
; tag-version-prefix=v
; timing=false
; tmp=/var/folders/pn/b7vg58ts5_b9xc3b7zvvpn780000gr/T
; umask=0
; unicode=true
; update-notifier=true
; usage=false
; user-agent=npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}
; userconfig=~/.npmrc
; version=false
; versions=false
; viewer=man
; which=null
;
; workspaces=null
; workspaces-update=true
; yes=null
@grantspilsbury grantspilsbury added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Jan 27, 2023
@fritzy
Copy link
Contributor

fritzy commented Feb 27, 2023

I'm not able to reproduce this in npm@9.5.1. Can you include your computed configuration with npm config list?

@milaninfy
Copy link
Contributor

Closing due to age. If this is still a problem please feel free to reopen this issue, or create a new issue w/ steps to reproduce.

@milaninfy milaninfy closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

3 participants