parcel: parcel serve fails on 2.8.3 but works fine on 2.7.0

🐛 bug report

Trying to build a simple React / TypeScript project. On parcel 2.7.0, parcel serve and parcel build both run fine. On 2.8.3, parcel build runs fine but parcel serve runs into this error:

🚨 Build failed.

@parcel/core: Failed to resolve 'process' from './node_modules/.pnpm/react-error-overlay@6.0.9/node_modules/react-error-overlay/lib/index.js'

  /Users/max/development/jamax/node_modules/.pnpm/react-error-overlay@6.0.9/node_modules/react-error-overlay/lib/index.js:1:4450
  > 1 | s[o]:process.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,t="/"===a.charAt(0))}return(t?"/":"")+(e=r(n(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."},t.normalize=fu
  >   |      ^^^^^^^

@parcel/resolver-default: Node builtin polyfill "process/" is not installed, but auto install is disabled.

  /Users/max/development/jamax/node_modules/.pnpm/react-error-overlay@6.0.9/node_modules/react-error-overlay/lib/index.js:1:4450
  > 1 | s[o]:process.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,t="/"===a.charAt(0))}return(t?"/":"")+(e=r(n(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."},t.normalize=fu
  >   |      ^^^^^^^ used here

  💡 Install the "process/" package with your package manager, and run Parcel again.
  📝 Learn more: https://parceljs.org/features/node-emulation/#polyfilling-%26-excluding-builtin-node-modules

None of the workarounds in #7697 or #7060 seem to work. Also, I’ve tried enabling autoinstall and get a similar erorr:

🚨 Build failed.

@parcel/core: Failed to resolve 'process' from './node_modules/.pnpm/react-error-overlay@6.0.9/node_modules/react-error-overlay/lib/index.js'

  /Users/max/development/jamax/node_modules/.pnpm/react-error-overlay@6.0.9/node_modules/react-error-overlay/lib/index.js:1:4450
  > 1 | s[o]:process.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,t="/"===a.charAt(0))}return(t?"/":"")+(e=r(n(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."},t.normalize=fu
  >   |      ^^^^^^^

@parcel/resolver-default: Failed to install process: pnpm failed to install modules

  Error: Failed to install process: pnpm failed to install modules
      at $32ea97b83cf5d752$var$install (/Users/max/development/jamax/node_modules/.pnpm/@parcel+package-manager@2.8.3_@parcel+core@2.8.3/node_modules/@parcel/package-manager/lib/index.js:3690:15)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/max/development/jamax/node_modules/.pnpm/@parcel+utils@2.8.3/node_modules/@parcel/utils/lib/index.js:33579:13)
      at async $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/max/development/jamax/node_modules/.pnpm/@parcel+utils@2.8.3/node_modules/@parcel/utils/lib/index.js:33572:9)

🎛 Configuration (.babelrc, package.json, cli command)

broken package.json on 2.8.3

{
  "name": "users-react",
  "version": "1.0.0",
  "source": "src/index.html",
  "private": true,
  "scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": "> 0.5%, last 2 versions, not dead",
  "devDependencies": {
    "@parcel/config-default": "^2.8.3",
    "@parcel/core": "^2.8.3",
    "@parcel/transformer-typescript-tsc": "^2.8.3",
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.9",
    "@types/js-cookie": "^3.0.2",
    "@types/luxon": "^3.2.0",
    "@types/mixpanel-browser": "^2.38.0",
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@typescript-eslint/eslint-plugin": "^5.48.2",
    "@typescript-eslint/parser": "^5.48.2",
    "autoprefixer": "^10.4.13",
    "daisyui": "^2.47.0",
    "eslint": "^8.32.0",
    "parcel": "^2.8.3",
    "parcel-reporter-static-files-copy": "^1.5.0",
    "postcss": "^8.4.21",
    "tailwindcss": "^3.2.4",
    "typescript": "^4.9.4"
  },
  "@parcel/transformer-js": {
    "inlineEnvironment": [
      "REACT_APP_*",
      "NODE_ENV"
    ]
  },
  "alias": {
    "process": false
  },
  "targets": {
    "main": {
      "context": "browser"
    }
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.2.1",
    "@fortawesome/free-brands-svg-icons": "^6.2.1",
    "@fortawesome/free-regular-svg-icons": "^6.2.1",
    "@fortawesome/free-solid-svg-icons": "^6.2.1",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@hookform/devtools": "^4.3.0",
    "@rpldy/upload-button": "^1.3.1",
    "@rpldy/uploady": "^1.3.1",
    "clsx": "^1.2.1",
    "js-cookie": "^3.0.1",
    "localforage": "^1.10.0",
    "luxon": "^3.2.1",
    "match-sorter": "^6.3.1",
    "mixpanel-browser": "^2.45.0",
    "process": "^0.11.10",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.42.1",
    "react-router-dom": "^6.7.0",
    "react-router-typesafe-routes": "^0.5.1",
    "shared": "workspace:^1.0.0",
    "sort-by": "^1.2.0"
  }
}

working package.json on 2.7.0

{
  "name": "users-react",
  "version": "1.0.0",
  "source": "src/index.html",
  "private": true,
  "scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": "> 0.5%, last 2 versions, not dead",
  "devDependencies": {
    "@parcel/config-default": "~2.7.0",
    "@parcel/core": "~2.7.0",
    "@parcel/transformer-typescript-tsc": "~2.7.0",
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.9",
    "@types/js-cookie": "^3.0.2",
    "@types/luxon": "^3.2.0",
    "@types/mixpanel-browser": "^2.38.0",
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@typescript-eslint/eslint-plugin": "^5.48.2",
    "@typescript-eslint/parser": "^5.48.2",
    "autoprefixer": "^10.4.13",
    "daisyui": "^2.47.0",
    "eslint": "^8.32.0",
    "parcel": "~2.7.0",
    "parcel-reporter-static-files-copy": "^1.5.0",
    "postcss": "^8.4.21",
    "tailwindcss": "^3.2.4",
    "typescript": "^4.9.4"
  },
  "@parcel/transformer-js": {
    "inlineEnvironment": [
      "REACT_APP_*",
      "NODE_ENV"
    ]
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.2.1",
    "@fortawesome/free-brands-svg-icons": "^6.2.1",
    "@fortawesome/free-regular-svg-icons": "^6.2.1",
    "@fortawesome/free-solid-svg-icons": "^6.2.1",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@hookform/devtools": "^4.3.0",
    "@rpldy/upload-button": "^1.3.1",
    "@rpldy/uploady": "^1.3.1",
    "clsx": "^1.2.1",
    "js-cookie": "^3.0.1",
    "localforage": "^1.10.0",
    "luxon": "^3.2.1",
    "match-sorter": "^6.3.1",
    "mixpanel-browser": "^2.45.0",
    "process": "^0.11.10",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.42.1",
    "react-router-dom": "^6.7.0",
    "react-router-typesafe-routes": "^0.5.1",
    "shared": "workspace:^1.0.0",
    "sort-by": "^1.2.0"
  }
}

🤔 Expected Behavior

parcel serve should successfully run in 2.8.3 as it does in 2.7.0

😯 Current Behavior

parcel serve does not successfully run in 2.8.3 as it does in 2.7.0

💁 Possible Solution

downgrade to 2.7.0

🔦 Context

forces me to stay on an old version.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.7.0 / 2.8.3
Node 16.19.0
pnpm 7.22
Operating System OSX / ARM

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@mischnic I was having trouble installing the packages off the branch but I gave up and created a top level package.json to install process. Its not what I’d prefer, but it works so I’m happy.

Thanks for your help.