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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing @parcel/transformer-typescript-types... fails when copy repo to another machine #7861

Closed
proper-px opened this issue Mar 24, 2022 · 3 comments

Comments

@proper-px
Copy link

proper-px commented Mar 24, 2022

馃悰 bug report

I initially created a new project with v2.3.2, with Typescript, Storybook, Styled-components, the whole 9. The initial project setup went very smooth and I was up and running in about 30 minutes. However moving into a few weeks later to start working on my component library, I copied the repo locally to another machine, using the same versions of node and npm. I ran npm install, npm run build and then not so happy.

It very well may be something I'm doing wrong, it's been a long week. Looking forward to hearing a possible solution to this! Enjoying your services.

馃帥 Configuration

package.json

{
  "name": "component-library",
  "version": "1.0.0",
  "description": "",
  "source": "src/index.ts",
  "main": "dist/main.js",
  "module": "dist/module.js",
  "types": "dist/types.d.ts",
  "type": "module",
  "scripts": {
    "start": "npm run storybook",
    "build": "parcel build",
    "test": "echo \"Error: no test specified\" && exit 1",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "plop": "plop"
  },
  "devDependencies": {
    "@babel/core": "^7.17.5",
    "@parcel/packager-ts": "^2.4.0",
    "@storybook/addon-actions": "^6.4.19",
    "@storybook/addon-essentials": "^6.4.19",
    "@storybook/addon-interactions": "^6.4.19",
    "@storybook/addon-links": "^6.4.19",
    "@storybook/react": "^6.4.19",
    "@storybook/testing-library": "^0.0.9",
    "@types/react": "^17.0.39",
    "@types/react-dom": "^17.0.13",
    "@types/styled-components": "^5.1.24",
    "babel": "^6.23.0",
    "babel-loader": "^8.2.3",
    "babel-plugin-styled-components": "^2.0.6",
    "parcel": "^2.4.0",
    "plop": "^3.0.5",
    "typescript": "^4.6.2"
  },
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "styled-components": "^5.3.3"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "jsx": "preserve",

    /* Modules */
    "module": "commonjs",

    /* Interop Constraints */
    "isolatedModules": true,
    "esModuleInterop": true 
    "forceConsistentCasingInFileNames": true,

    /* Type Checking */
    "strict": true,
    "skipLibCheck": true
  }
}

馃 Expected Behavior

To be able to have multiple people on different machines be able to copy repo from github and easily install dependencies, and build the library for local testing.

馃槸 Current Behavior

馃毃 Build failed.

unknown: Could not resolve module "@parcel/transformer-typescript-types" from "/Users/d444/index"
馃挕 Autoinstall is disabled, please install this package manually and restart Parcel.

I did all of the suggestions, with no luck, I even tried updating to the latest release from a couple of days ago v2.4.0 with no luck either.

After the failed install my package.json file now looks like this

This is the entire file, not just a snippet

{
  "devDependencies": {
    "@parcel/transformer-typescript-types": "^2.4.0"
  }
}

When I look in my node_modules folder all of the dependencies are there.

馃拋 Possible Solution

Wish I had a solution but so far anything I can think of hasn't been plentiful.

馃敠 Context

Right now, this is really only affecting me as the project is just getting underway, however we may need to find an alternative resource to help with the component-library

馃捇 Code Sample

https://github.com/proper-px/component-library

馃實 Your Environment

Software Version(s)
Parcel 2.4.0
Node 16.13.1
npm/Yarn 8.1.2
Operating System macOS 11.4
@Zertz
Copy link

Zertz commented Mar 24, 2022

I'm running into the same issue on my local machine. Here's a working build on GitHub Actions: https://github.com/Zertz/react-headless-tabs/runs/5681490759

Locally (M1 Pro Mac), I'm getting different errors (for reasons unbeknownst to me!) in these terminals:

VS Code (zsh)

馃毃 Build failed.

Error: dlopen(/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/transformer-js/parcel-swc.darwin-arm64.node, 0x0001): cannot dlopen until fork() handlers
have completed

  Error: dlopen(/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/transformer-js/parcel-swc.darwin-arm64.node, 0x0001): cannot dlopen until fork()
  handlers have completed
  at Object.Module._extensions..node (node:internal/modules/cjs/loader:1185:18)
  at Module.load (node:internal/modules/cjs/loader:981:32)
  at NodePackageManager.load (/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/package-manager/lib/index.js:3374:15)
  at NodePackageManager.requireSync (/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/package-manager/lib/index.js:3352:21)
  at Module.m.require (/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/package-manager/lib/index.js:3365:25)
  at require (node:internal/modules/cjs/helpers:102:18)
  at Object.<anonymous> (/Users/pierluc/Documents/GitHub/react-headless-tabs/node_modules/@parcel/transformer-js/native.js:30:20)
  at Module._compile (node:internal/modules/cjs/loader:1103:14)
  at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
  at Module.load (node:internal/modules/cjs/loader:981:32)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Warp

馃毃 Build failed.

unknown: Could not resolve module "@parcel/transformer-typescript-types" from "/Users/pierluc/index"
馃挕 Autoinstall is disabled, please install this package manually and restart Parcel.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This happens even after running git clean -xdf and yarn --frozen-lockfile

I was about to publish a new version react-headless-tabs so you can use the main branch to try and reproduce the issue locally!

@mischnic
Copy link
Member

Essentially a duplicate of #7515. The project root isn't determined correctly:

Could not resolve module "@parcel/transformer-typescript-types" from "/Users/pierluc/index"

Could not resolve module "@parcel/transformer-typescript-types" from "/Users/d444/index"

I'm not sure why a different machine or CI would change this.

As a workaround, use parcel build src/index.ts instead of parcel build (so explicitly specify the source field) as a the CLI parameter.

Will be fixed by #7537

@Zertz
Copy link

Zertz commented Mar 24, 2022

Just FYI, it worked fine as-is before 2.4.0

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

No branches or pull requests

3 participants