Typescript compile fails in build - works locally

Hi,
I’m getting the following build failures - which don’t appear locally:

npm test

door-key@1.0.6 test /home/ubuntu/door-key
tsc && nodeunit test/units.js

node_modules/@types/uuid/node_modules/@types/node/index.d.ts(2381,15): error TS2300: Duplicate identifier ‘URL’.
node_modules/@types/uuid/node_modules/@types/node/index.d.ts(2399,15): error TS2300: Duplicate identifier ‘URLSearchParams’.
node_modules/@types/uuid/node_modules/@types/node/index.d.ts(2417,14): error TS2661: Cannot export ‘URL’. Only local declarations can be exported from a module.
node_modules/@types/uuid/node_modules/@types/node/index.d.ts(2417,19): error TS2661: Cannot export ‘URLSearchParams’. Only local declarations can be exported from a module.
node_modules/typescript/lib/lib.dom.d.ts(13401,11): error TS2300: Duplicate identifier ‘URL’.
node_modules/typescript/lib/lib.dom.d.ts(13417,13): error TS2300: Duplicate identifier ‘URL’.
node_modules/typescript/lib/lib.dom.d.ts(13424,11): error TS2300: Duplicate identifier ‘URLSearchParams’.
node_modules/typescript/lib/lib.dom.d.ts(13451,13): error TS2300: Duplicate identifier ‘URLSearchParams’.
node_modules/typescript/lib/lib.dom.d.ts(15737,13): error TS2300: Duplicate identifier ‘URL’.
node_modules/typescript/lib/lib.dom.d.ts(15738,13): error TS2300: Duplicate identifier ‘URLSearchParams’.
npm ERR! Test failed. See above for more details.

npm test returned exit code 1

"node": "^8.11"
"@firebase/app-types": "^0.1.0",
"@types/loglevel": "^1.5.3",
"@types/marked": "^0.3.0",
"@types/react": "^16.3.12",
"@types/react-burger-menu": "^2.2.0",
"@types/react-dom": "^16.0.5",
"@types/underscore": "^1.8.8",
"@types/underscore.string": "^0.0.32",
"create-react-class": "^15.6.2",
"firebase": "^4.12.0",
"loglevel": "^1.6.0",
"marked": ">= 0.3.6",
"moment": "^2.21.0",
"nodeunit": "^0.11.2",
"react": "^16.3.1",
"react-burger-menu": "^2.4.2",
"react-dom": "^16.3.2",
"react-star-rating-lite": "^0.0.6",
"ts-loader": "^4.2.0",
"typescript": "^2.8.3",
"underscore": "1.8.3",
"underscore.string": "^3.3.4",
"uuid": "^3.1.0",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15",
"webpack-dev-server": "^3.1.3",
"webpack-merge": "^4.1.2"

Any help would be gratefully accpeted!

Thanks

My experience is that a CI problem happening remotely and not locally is not necessarily an issue with the CI system itself. Thus, I would tackle this as if it were happening locally, and fix it using the usual search/amend/retry development workflow. Don’t forget you have SSH access to try things in an interactive console.

Searching for your error gives me this - any good?

Thanks for your response. I’m sure there isn’t an issue with the CI system, I’m just struggling a bit to use it.

I have started using SSH access to have a look around and try to figure out what is going on, but I don’t find it much help.

There are several things I don’t understand, and might possibly be related:

  1. No matter what I try, it appears the VM runs with node v4.2.6 (as shown by “node --version)”, not the version I need, v8.11.1, which I am specifying as the docker build “image: circleci/node:8.11.1”. I’m sure I’m doing something wrong, but I can’t see what.

  2. I am specifying yarn rather than npm commands in my script, but the output appears to show that npm is being run. No idea why.

It’s hard to nail down exactly what my problem is, when I don’t really understand what is going on in the build process.

Any help is most appreciated,

I wonder if it would help to post your whole config.yml file (in a formatted block) in case anything jumps out for readers?

I am not familiar with the circleci/node image you are using. Perhaps things will be clear when we can see how you are installing Node. One thing I’d try (and I say this as a non-Node user) is starting from a simpler image and installing Node myself. I use docker:17.05.0-ce-git and things have been plain sailing for me.

Here’s my full config.yaml file:

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:8.11.1

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mongo:3.4.4

    working_directory: ~/repo

    steps:
      - checkout
      ## trying this to upgrade node - seems to have no effect...
      - run:
        - name: Update node to v8.11.1
        - shell: /bin/sh
        - command: nvm install v8.11.1

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: yarn install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: yarn test

Will try your suggestion of starting with a simpler image and installing node myself - will post the config file if it works…

1 Like

What is the console output of the nvm install v8.11.1? Maybe that installs what you need to a location that is not in the PATH, or is in part of the PATH with a lower precedence than the image version?

Okay confession time…

Thanks for your input, but I’ve just found the solution - I had called my config file “config.yaml” - it should have been “config.yml” - so was being entirely ignored. CircleCI’s behaviour in the absence of a config file was similar to what I was expecting…

Sorry.

Ha, it’s happened here before! No worries, glad you found it :smiley_cat:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.