redash icon indicating copy to clipboard operation
redash copied to clipboard

Critical error with npm run build

Open huzaifahj opened this issue 4 years ago • 25 comments

Issue Summary

error TS2688: Cannot find type definition file for 'jest'.

The debug log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]: [email protected]
6 info lifecycle [email protected]: [email protected]
7 verbose lifecycle [email protected]: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/redash/redash-master/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
9 verbose lifecycle [email protected]: CWD: /opt/redash/redash-master
10 silly lifecycle [email protected]: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'npm run clean && npm run build:viz && NODE_ENV=production webpack'
10 silly lifecycle ]
11 silly lifecycle [email protected]: Returned: code: 2 signal: null
12 info lifecycle [email protected]: Failed to exec build script
13 verbose stack Error: [email protected] build: npm run clean && npm run build:viz && NODE_ENV=production webpack
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1022:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /opt/redash/redash-master
16 verbose Linux 4.18.0-240.1.1.el8_3.x86_64
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v12.20.1
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: npm run clean && npm run build:viz && NODE_ENV=production webpack
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Steps to Reproduce

  • pip3 install -r requirements.txt -r requirements_dev.txt
  • npm install
  • npm run build

Technical details:

Redash Version: the last version Browser/OS: Ubuntu 18.04 How did you install Redash: Developer Installation Guide

huzaifahj avatar Jan 19 '21 10:01 huzaifahj

Hi, we are the same problem. you can see the viz-lib/package.json , Whether the dependent files are downloaded to the viz-lib/node_modules folder . if not, You should copy the dependencies in the ./node_modules directory to the viz-lib/node_modules. so you run "npm run build" , In addition, you also need to fix sql-formatter error https://discuss.redash.io/t/9-0-0-beta-developer-installation-error-cant-resolve-sql-formatter/7668 . good luck!

florenbai avatar Jan 20 '21 03:01 florenbai

Which exact dependencies did you copy? Why does npm install in viz-lib not install them.

huzaifahj avatar Jan 20 '21 10:01 huzaifahj

I don't know why does npm install in viz-lib not install them. but they can find in the node_modules folder of the root directory .

florenbai avatar Jan 22 '21 08:01 florenbai

try: nvm ls-remote --lts nvm install 12.21.0 nvm use 12.21.0

xiaodin1 avatar Mar 02 '21 03:03 xiaodin1

same question

p294960570 avatar Apr 01 '21 07:04 p294960570

Can anyone share steps to reproduce this error? When I use the Docker installation on MacOS everything works.

susodapop avatar Apr 01 '21 19:04 susodapop

Similarly, I get this error if I clone the repo and run yarn build (on Ubuntu 20.04):

$  yarn build

yarn run v1.22.10
$ yarn clean && yarn build:viz && NODE_ENV=production webpack
$ rm -rf ./client/dist/
$ (cd viz-lib && yarn build:babel)
$ yarn type-gen && yarn build:babel:base
$ tsc --emitDeclarationOnly
error TS2688: Cannot find type definition file for 'jest'.
  The file is in the program because:
    Entry point of type library 'jest' specified in compilerOptions

  tsconfig.json:8:23
    8     "types": ["node", "jest"],
                            ~~~~~~
    File is entry point of type library specified here.

error TS2688: Cannot find type definition file for 'node'.
  The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions

  tsconfig.json:8:15
    8     "types": ["node", "jest"],
                    ~~~~~~
    File is entry point of type library specified here.


Found 2 errors.

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

rotten avatar Dec 12 '21 17:12 rotten

viz-lib

yes !!!
cd viz-lib npm i

Darren-chenchen avatar Mar 17 '22 11:03 Darren-chenchen

@rotten I'm getting the same error as you. How did you fix it?

dufferzafar avatar Jul 12 '22 13:07 dufferzafar

I'm not sure I did. I don't remember now. sorry! I stopped using redash shortly after this. I'll try again later today if I get time to see if I can reproduce it or whether I managed to fix it and forgot what I did. I'd like to use redash again some day.

rotten avatar Jul 12 '22 14:07 rotten

Redash uses yarn now instead of npm. Curious whether you see issues running yarn install and yarn build

susodapop avatar Jul 12 '22 14:07 susodapop

@susodapop I first ran yarn --frozen-lockfile and then yarn build which is when I got the errors mentioned by @rotten

dufferzafar avatar Jul 12 '22 15:07 dufferzafar

What version of yarn are you using?

susodapop avatar Jul 12 '22 16:07 susodapop

yarn --version
1.22.10

Doing yarn --frozen-lockfile didn't actually create a node_modules folder in the current directory. I'm not sure where it installed the packages.

dufferzafar avatar Jul 13 '22 05:07 dufferzafar

Bizarre. And which version of Node?

susodapop avatar Jul 13 '22 06:07 susodapop

node --version
v14.17.1

dufferzafar avatar Jul 13 '22 06:07 dufferzafar

And to confirm, which directory are you in when you run these commands?

For clarity, it isn't necessary to run yarn install within the viz-lib folder. The instructions say to run them from the root of the repository.

susodapop avatar Jul 13 '22 11:07 susodapop

Yes, that is what I'm trying to do. yarn was not creating a node_modules folder, so I did npm install which worked 😓

dufferzafar avatar Jul 13 '22 11:07 dufferzafar

Which operating system?

susodapop avatar Jul 13 '22 13:07 susodapop

CentOS 7

dufferzafar avatar Jul 13 '22 16:07 dufferzafar

the same error to me.

My mac is M1 Pro. And I follow this guide: https://redash.io/help/open-source/dev-guide/docker . The previous steps worked, but when I run into yarn build, this error occured.

image

kingname avatar Aug 07 '22 15:08 kingname

I have solved this problem, bros.

cd to the root folder of redash. Run the following command.

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
yarn install
yarn build

It is work like a charm.

kingname avatar Aug 07 '22 16:08 kingname

yarn Installation continues to fail,fail usually in step2 or step3,how can i install this project?

mumu1349562746 avatar Aug 15 '22 03:08 mumu1349562746

computer system : windows 10

mumu1349562746 avatar Aug 15 '22 03:08 mumu1349562746

@mumu1349562746 none of the core team develops on Windows so we don't have much guidance here. That said, you haven't given any debugging info. Can you share what exact error you receive or what workarounds you have tried?

susodapop avatar Aug 17 '22 15:08 susodapop

Similar problem, yarn Installation continues to fail.

hantmac avatar Mar 22 '23 07:03 hantmac

If stumbling into any of these issues, make sure: 1) you use yarn and not npm; 2) you use a Node version that is compatible with the engines definition in package.json (I believe that recent versions of yarn will warn you about this).

I couldn't reproduce this on recent master, but please re-open if this happens again.

arikfr avatar Mar 22 '23 16:03 arikfr

Hello, here again with same error from above...

Trying to install redash-10.0.0 Ubuntu 20.04 Node 12.0.0 (tried with 14.17.1 as well) Yarn 1.22.10

followed this guide https://redash.io/help/open-source/dev-guide/setup

Do someone have solution for this?

SlavchoSpasenoski avatar Apr 02 '23 22:04 SlavchoSpasenoski

@SlavchoSpasenoski I wouldn't expect it to work with Node 12. What was the error when working with Node 14.17.1?

Btw, are you setting it up to develop Redash or just to use it?

arikfr avatar Apr 05 '23 13:04 arikfr

Hello @arikfr,

Error for node 14.17.1 was: type-gen: failed to exec type-gen script (Very similar as very first post above)

But I was tried to use master repo instead version 10.0.0, and everything related to Yarn is installed without errors.

My main goal is to deploy redash 10 (or above) without docker (for use it, not develop) (It were explained by Me in discussion https://github.com/getredash/redash/discussions/5955 )

For now I successfully installed and running Redash (from master-repo) without docker on Ubuntu 20.04. works fine with local instances as data sources (tested with MySql 5.7 server)... But now facing error with REDASH_COOKIE_SECRET. It can't read it from env file. I am sure, that env file is correct filled and configured in correct path...

Mine script is following: Redash_install_withoutDocker.txt

Error that I have image

To fix this, I temporary hardcoding COOKIE_SECRET in /redash/settings/init.py to successfully run redash server & workers

SlavchoSpasenoski avatar Apr 05 '23 14:04 SlavchoSpasenoski