question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

01-cats-app - npm run start:prod

See original GitHub issue

Hello

@kamilmysliwiec

I have created a repo I have built typeorm - jest - class-validator - passport all is fine but when I run the command “npm run start: prod” the following error message appears, I thought that this is a bad configuration but I tested the command in the application “01-cats-app” but the error always appears

E:\Projets\WebStorm\01-cats-app\01-cats-app>npm run start:prod

> nest-typescript-starter@1.0.0 prestart:prod E:\Projets\WebStorm\01-cats-app\01-cats-app
> tsc

node_modules/@types/jest/index.d.ts(14,13): error TS2300: Duplicate identifier 'beforeEach'.
node_modules/@types/jest/index.d.ts(16,13): error TS2300: Duplicate identifier 'afterEach'.
node_modules/@types/mocha/index.d.ts(33,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'describe' must be of type 'Describe', but here has type 'IContextDefinition'.
node_modules/@types/mocha/index.d.ts(34,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'xdescribe' must be of type 'Describe', but here has type 'IContextDefinition'.
node_modules/@types/mocha/index.d.ts(39,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'it' must be of type 'It', but here has type 'ITestDefinition'.
node_modules/@types/mocha/index.d.ts(40,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'xit' must be of type 'It', but here has type 'ITestDefinition'.
node_modules/@types/mocha/index.d.ts(42,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'test' must be of type 'It', but here has type 'ITestDefinition'.
node_modules/@types/mocha/index.d.ts(60,18): error TS2300: Duplicate identifier 'beforeEach'.
node_modules/@types/mocha/index.d.ts(61,18): error TS2300: Duplicate identifier 'beforeEach'.
node_modules/@types/mocha/index.d.ts(62,18): error TS2300: Duplicate identifier 'afterEach'.
node_modules/@types/mocha/index.d.ts(63,18): error TS2300: Duplicate identifier 'afterEach'.

thanks for help

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

24reactions
brunobuddycommented, Mar 13, 2018

I found the problem.

It’s related to TypeORM’s ormconfig.json. By default it looks for entities in the /src folder and opens TypeScript files instead of the Javascript compiled ones.

The solution I found was using a dynamic ormconfig.js (instead of .json) that has a conditional path. Docs here => http://typeorm.io/#/using-ormconfig/loading-from-ormconfigjs

In my case my ormconfig.js looks like that (assuming that you have a dotenv variable called NODE_ENV) :

const SOURCE_PATH = process.env.NODE_ENV === 'production' ? 'dist' : 'src'

module.exports = {
    type: 'sqlite',
    database: './db/myDatabase.db',
    entities: [`${SOURCE_PATH}/**/**.entity{.ts,.js}`],
}
14reactions
asechercommented, Feb 4, 2018

For everyone that gets this error in the examples, look in the ormconfig.json file, it looks for entities in the src directory.

When you run npm run start:prod the entities will be in the dist directory.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create-react-app npm run start in production mode. Maybe ...
The best option is probably to do a normal production build and then run it locally. First install an HTTP server: npm install...
Read more >
npm-start
This runs a predefined command specified in the "start" property of a package's "scripts" object. If the "scripts" object does not define a...
Read more >
➫ How to npm run start at the background ⭐️ | by Ido ...
How to npm run start at the background ⭐️. So I have a (Vue/Angular/React).JS web application and I need to run it in...
Read more >
Getting Started - Razzle
npm run start:prod#. Runs the compiled app in production. You can again view your application at http://localhost:3000. npm test ...
Read more >
Create a New React App
npx create-react-app my-app cd my-app npm start ... When you're ready to deploy to production, running npm run build will create an optimized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found