myDrive icon indicating copy to clipboard operation
myDrive copied to clipboard

npm ERR! [email protected] build: `tsc && webpack -p --env production && webpack --config webUI.config.js && webpack --config webUISetup.config.js`

Open SystemDZ opened this issue 2 years ago • 3 comments

npm run build is causing this current issue

i had many issues at the beginning, such as node_gyp, diskusage, installing python, c++ devtools, etc ..

image

npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] build: tsc && webpack -p --env production && webpack --config webUI.config.js && webpack --config webUISetup.config.js` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users***\AppData\Roaming\npm-cache_logs\2022-02-27T04_23_46_689Z-debug.log`

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\*******\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'build' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle [email protected]~prebuild: [email protected] 6 info lifecycle [email protected]~build: [email protected] 7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~build: PATH: C:\Users\*******\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\github\Mern\myDrive\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\*******\bin;C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\*******\AppData\Local\Programs\Python\Python38;C:\Python38\scripts;C:\Program Files\MongoDB\Server\4.4\bin;C:\Program Files (x86)\Yarn\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\nodejs;C:\Program Files\MySQL\MySQL Shell 8.0\bin;C:\Users\*******\AppData\Local\Programs\Python\Python38\Scripts;C:\Users\*******\AppData\Local\Programs\Python\Python38;C:\Users\*******\AppData\Local\Microsoft\WindowsApps;C:\Users\*******\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\*******\AppData\Local\GitHubDesktop\bin;C:\Program Files\heroku\bin;C:\Users\*******\AppData\Local\Yarn\bin;C:\ProgramData\*******\gitkraken\bin;C:\Users\*******\AppData\Local\Microsoft\WindowsApps;C:\Users\*******\AppData\Local\Android\Sdk\emulator;C:\Users\*******\AppData\Local\Android\Sdk\platform-tools;C:\Users\*******\AppData\Roaming\npm;C:\Program Files\MySQL\MySQL Server 8.0\bin 9 verbose lifecycle [email protected]~build: CWD: E:\github\Mern\myDrive 10 silly lifecycle [email protected]~build: Args: [ 10 silly lifecycle '/d /s /c', 10 silly lifecycle 'tsc && webpack -p --env production && webpack --config webUI.config.js && webpack --config webUISetup.config.js' 10 silly lifecycle ] 11 silly lifecycle [email protected]~build: Returned: code: 2 signal: null 12 info lifecycle [email protected]~build: Failed to exec build script 13 verbose stack Error: [email protected] build: tsc && webpack -p --env production && webpack --config webUI.config.js && webpack --config webUISetup.config.js13 verbose stack Exit status 2 13 verbose stack at EventEmitter.<anonymous> (C:\Users\*******\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:376:20) 13 verbose stack at ChildProcess.<anonymous> (C:\Users\*******\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:376:20) 13 verbose stack at maybeClose (internal/child_process.js:1055:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) 14 verbose pkgid [email protected] 15 verbose cwd E:\github\Mern\myDrive 16 verbose Windows_NT 10.0.22000 17 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\*******\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" 18 verbose node v14.17.0 19 verbose npm v6.14.16 20 error code ELIFECYCLE 21 error errno 2 22 error [email protected] build:tsc && webpack -p --env production && webpack --config webUI.config.js && webpack --config webUISetup.config.js22 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 ]

Another Question how can i add env files to the project?

Thanks

SystemDZ avatar Feb 27 '22 04:02 SystemDZ

This fixed it for me: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/53397#issuecomment-1246845972

kerberjg avatar Nov 29 '22 09:11 kerberjg

updating the package.json with

"@types/express-serve-static-core": "4.17.20"
"@types/express": "4.17.2"

fixed all but 7 errors for me. All relating to babel__traverse what version does it need to be updated to to resolve that issue?

agusiaKrzywinska avatar May 13 '23 03:05 agusiaKrzywinska

If anyone else is struggling to get the app installed and working (including file uploads) in 2023, here's what worked for me:

  1. If you're using a newer Mac running Apple silicon (M1/M2 chip) you'll need to start your terminal using the "Open using Rosetta" option so that it runs in the x86_64 / i386 architecture instead of Apple's arm64 architecture. Otherwise you'll get errors about "zlib".

  2. After installing node 15.4.0 (use nvm if you want to have more than 1 node version installed on your machine), you'll need to update the version of npm to version 8.3+ since the default version doesn't support "overrides" which you'll need below:

    npm install -g npm@latest

  3. Update package.json as follows (notice the +/- to the left)...

    To fix all build errors:

    +    "@types/babel__core": "7.1.18",
    +    "@types/babel__traverse": "7.14.2",
    +    "@types/express-serve-static-core": "4.17.20",
    -    "@types/express": "^4.17.6",
    +    "@types/express": "4.17.2",
    

    ...then add this below the devDependencies block:

    +    "overrides": {
    +        "@types/mongodb": {
    +            "@types/bson": "4.0.5"
    +        }
    +    }
    

    To fix file upload errors:

    -    "@types/connect-busboy": "0.0.2"
    +    "@types/connect-busboy": "0.0.3"
    -    "connect-busboy": "0.0.2"
    +    "connect-busboy": "0.0.3"
    
    
  4. Update webpack.config.js putting this change just below outputDir: "/dist/",:

    + apiUrl: "https://gwfh.mranftl.com/api/fonts",

Once that's all done, follow the myDrive installation instructions: npm install, npm run build, etc.

References for some of the above solutions:

  • https://stackoverflow.com/questions/72717949/error-in-node-modules-types-babel-traverse-index-d-ts68-50-error-ts1005
  • https://stackoverflow.com/questions/75512665/types-mongodb-index-d-ts3518-error-ts2724-bson-has-no-exported-memb
  • https://github.com/beyonk-group/google-fonts-webpack-plugin/issues/22
  • https://www.stefanjudis.com/today-i-learned/how-to-override-your-dependencys-dependencies/

dkoo761 avatar Aug 16 '23 06:08 dkoo761