Docker build for React App failing in Gitlab CI runner - node.js

I have been trying to create a react app Gitlab CI but it keeps failing on the RUN npm run build (tried RUN CI=true npm run build too) when trying to create a docker file.
Here's my Dockerfile
FROM node:8.11.1
# Create app directory
WORKDIR /app/
# Install app dependencies
RUN npm -g install serve
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json /app/
RUN npm install
# Bundle app source
COPY . /app/
RUN ls /app/
#Build react/vue/angular bundle static files
RUN npm run build
EXPOSE 5000
# serve build folder on port 5000
CMD ["serve", "-s", "build", "-p", "5000"]
fails at step RUN npm run build with the following error:
Step 8/10 : RUN npm run build
---> Running in d4b3bc5de229
> payed-fe#0.1.0 build /app
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/index.js
Cannot find file './app' in './src'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! payed-fe#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the payed-fe#0.1.0 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! /root/.npm/_logs/2018-12-20T15_52_14_979Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
ERROR: Job failed: exit code 1
However on my local machine everything works like a charm (npm start, npm run build, even same Dockerfile on my local builds successfully).
Thanks in Advance!
--- EDIT 1 ---
yes ls gives the same output on my local system and CI.
./src/index.js is just my entry file. Here are the contents:
import React from "react";
import ReactDOM from "react-dom";
import App from "./app";
import * as serviceWorker from "./serviceWorker";
ReactDOM.render(<App />, document.getElementById("root"));
serviceWorker.unregister();
And yes the paths are perfectly alright as it is running successfully on my local machine.
--- EDIT 2 ---
Output of /root/.npm/_logs/*.log after I changed the working dir to /payed - Still no luck!
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#5.6.0
3 info using node#v8.11.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle payed-fe#0.1.0~prebuild: payed-fe#0.1.0
6 info lifecycle payed-fe#0.1.0~build: payed-fe#0.1.0
7 verbose lifecycle payed-fe#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle payed-fe#0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/payed/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle payed-fe#0.1.0~build: CWD: /payed
10 silly lifecycle payed-fe#0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle payed-fe#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle payed-fe#0.1.0~build: Failed to exec build script
13 verbose stack Error: payed-fe#0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid payed-fe#0.1.0
15 verbose cwd /payed
16 verbose Linux 4.14.48-coreos-r2
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v8.11.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error payed-fe#0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the payed-fe#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Try CI=false
CI=true is the default...

Related

Looking for possible reasons why Next.js Node Server crashes: "npm ERR! code ELIFECYCLE errno 3221225477"

This happened on node version 14.16.0. I encountered the error twice now.
The first time i created a react component with the #mui/lab/DateTimePicker.
I didn't have to install it since #mui/lab was already existing in the project. (tried to reproduce this on another branch(very few changes apart). Didn't work so probably has nothing to do with mui itself)
The second time was also the second approach to the time input component. Using another simpler node module which i had to install this time. (also couldn't reproduce this case) (worked like a charm the second time)
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from C:\develop\strapi-nextjs-poc\nextjs\.env
info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
event - compiled successfully in 5.7s (2008 modules)
wait - compiling /...
info - Using external babel configuration from C:\develop\strapi-nextjs-poc\nextjs\.babelrc
[styled-jsx] Loading plugin from path: C:\develop\strapi-nextjs-poc\nextjs\node_modules\#styled-jsx\plugin-sass\index.js
event - compiled successfully in 6.9s (2236 modules)
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! nextjs#0.1.0 dev: `next dev`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the nextjs#0.1.0 dev 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\sk\AppData\Roaming\npm-cache\_logs\2022-02-17T12_52_28_233Z-debug.log
/c/Program Files/nodejs/npm: line 37: 3732 Segmentation fault "$NODE_EXE" "$NPM_CLI_JS" "$#"
Reverting the current changes sadly doesn't do anything. Even after removing all changes since the last working commit, the branch is still broken.
What i tried so far (in this order):
remove dependencies from sourcecode und package json (just removed everything since last working commit)
deleted .nextjs folder (for caching)
deleted node_modules folder
using nvm to remove the current node version and re-installing it
npm cache clean --force
npm install
After encoutering the error once, it seems to be a permanent issue on the branch (even for other people pulling). So the branch is basicly not useable anymore.
The only way i found to fix the recurrence of the error was upgrading node. Tried with v14.19.0
This just brings the problem of other possible problems with the node version in the project.
Any ideas why this is happening, what causes it or what might fix it?
full log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.14.11
3 info using node#v14.16.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle nextjs#0.1.0~predev: nextjs#0.1.0
6 info lifecycle nextjs#0.1.0~dev: nextjs#0.1.0
7 verbose lifecycle nextjs#0.1.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle nextjs#0.1.0~dev: PATH: C:\Users\sk\AppData\Roaming\nvm\v14.16.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\develop\strapi-nextjs-poc\nextjs\node_modules\.bin;C:\Users\sk\bin;C:\Users\sk\AppData\Local\Programs\Git\mingw64\bin;C:\Users\sk\AppData\Local\Programs\Git\usr\local\bin;C:\Users\sk\AppData\Local\Programs\Git\usr\bin;C:\Users\sk\AppData\Local\Programs\Git\usr\bin;C:\Users\sk\AppData\Local\Programs\Git\mingw64\bin;C:\Users\sk\AppData\Local\Programs\Git\usr\bin;C:\Users\sk\bin;C:\Python39\Scripts;C:\Python39;C:\Program Files\Zulu\zulu11.35.13-ca-jdk11.0.5-win_x64\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python38\Scripts;C:\Python38;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\adminal\.jpm\windows\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Users\sk\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\sk\AppData\Local\Microsoft\WindowsApps;C:\Users\sk\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\sk\AppData\Local\Programs\Git\usr\bin\vendor_perl;C:\Users\sk\AppData\Local\Programs\Git\usr\bin\core_perl
9 verbose lifecycle nextjs#0.1.0~dev: CWD: C:\develop\strapi-nextjs-poc\nextjs
10 silly lifecycle nextjs#0.1.0~dev: Args: [ '/d /s /c', 'next dev' ]
11 silly lifecycle nextjs#0.1.0~dev: Returned: code: 3221225477 signal: null
12 info lifecycle nextjs#0.1.0~dev: Failed to exec dev script
13 verbose stack Error: nextjs#0.1.0 dev: `next dev`
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (C:\Users\sk\AppData\Roaming\nvm\v14.16.0\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\sk\AppData\Roaming\nvm\v14.16.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid nextjs#0.1.0
15 verbose cwd C:\develop\strapi-nextjs-poc\nextjs
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v14.16.0
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 3221225477
22 error nextjs#0.1.0 dev: `next dev`
22 error Exit status 3221225477
23 error Failed at the nextjs#0.1.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
Based on error code - it looks like a win32 access violation error as detailed here
NodejS 14.6 is on maintenance mode - consider upgrading to 16 or 17
https://nodejs.org/en/about/releases/

After ejecting create-react-app to update packages, "webpack is not a function"

Using an older version create-react-app on an experimental boilerplate project, I needed to update the packages to proceed. I thought the best way to do this was to eject the create-react-app, but now the whole thing won't run. This is the output after Nodemon:
[1] Failed to compile.
[1]
[1] webpack is not a function
[1]
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! client#0.1.0 start: `node scripts/start.js`
[1] npm ERR! Exit status 1
[1] npm ERR!
npm ERR! Failed at the client#0.1.0 start script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! /Users/gabrielkunkel/.npm/_logs/2019-11-20T23_19_58_956Z-debug.log
If I search the complete log, webpack doesn't show up at all. I wish I could narrow this down to something just useful.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin/node',
1 verbose cli '/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.13.1
3 info using node#v12.8.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle client#0.1.0~prestart: client#0.1.0
6 info lifecycle client#0.1.0~start: client#0.1.0
7 verbose lifecycle client#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle client#0.1.0~start: PATH: /Users/gabrielkunkel/.nvm/versions/node/v12.8.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gabrielkunkel/Documents/DevCodeCamp/Capstone/kunkl-project/client/node_modules/.bin:/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gabrielkunkel/Documents/DevCodeCamp/Capstone/kunkl-project/node_modules/.bin:/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/gabrielkunkel/.rvm/bin:/Users/gabrielkunkel/.rvm/bin
9 verbose lifecycle client#0.1.0~start: CWD: /Users/gabrielkunkel/Documents/DevCodeCamp/Capstone/kunkl-project/client
10 silly lifecycle client#0.1.0~start: Args: [ '-c', 'node scripts/start.js' ]
11 silly lifecycle client#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle client#0.1.0~start: Failed to exec start script
13 verbose stack Error: client#0.1.0 start: `node scripts/start.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:203:13)
13 verbose stack at ChildProcess.<anonymous> (/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:203:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid client#0.1.0
15 verbose cwd /Users/gabrielkunkel/Documents/DevCodeCamp/Capstone/kunkl-project/client
16 verbose Darwin 16.7.0
17 verbose argv "/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin/node" "/Users/gabrielkunkel/.nvm/versions/node/v12.8.1/bin/npm" "start"
18 verbose node v12.8.1
19 verbose npm v6.13.1
20 error code ELIFECYCLE
21 error errno 1
22 error client#0.1.0 start: `node scripts/start.js`
22 error Exit status 1
23 error Failed at the client#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I tried cleaning out the node_modules and re-installing them off a suggestion here, with a slightly different problem. I even tried installing webpack globally.
I'm hoping to just fix some small thing and keep going or at least understand why it can't run webpack. As it is, I'm going to be saving all the files and rerun create-react-app unless you can help me.
Your best bet is to build a new create-react-app in a separate folder then to run npm run eject. You then use version control to see the differences in the package.json as well as the config and script folders/files. Update your node modules to match those of the newly created create-react-app and copy/paste the config files.

"npm run build" error when building on VSTS/Azure DevOps

I have a Vue project which compiles just fine on my machine. Today, I went and started its deploy setup on the Azure DevOps platform, which seems to run ok until "npm run build" is called. From there, I receive multiple "ELIFECYCLE" errors, what doesn't help me much.
What I've tried so far:
Tried deleting both node_modules and package-lock.json with npm clean cache and using cmd delete remove command
Tried on a Linux and Windows production machines
What am I missing here?
[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd run build"
- Building for production...
ERROR Build failed with errors.
> appwork-vue-starter#1.2.1 build D:\_work\1\s
npm ERR! code ELIFECYCLE
> vue-cli-service build
npm ERR! errno 1
npm ERR! appwork-vue-starter#1.2.1 build: `vue-cli-service build`
npm ERR! Exit status 1
ERROR Failed to compile with 1 errors9:12:59 PM
npm ERR!
npm ERR! Failed at the appwork-vue-starter#1.2.1 build script.
This relative module was not found:
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
* ./Router in ./src/main.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm\cache\_logs\2019-02-26T21_13_00_370Z-debug.log
Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\2019-02-26T21_13_00_370Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.7.0
3 info using node#v10.15.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle appwork-vue-starter#1.2.1~prebuild: appwork-vue-starter#1.2.1
6 info lifecycle appwork-vue-starter#1.2.1~build: appwork-vue-starter#1.2.1
7 verbose lifecycle appwork-vue-starter#1.2.1~build: unsafe-perm in lifecycle true
8 verbose lifecycle appwork-vue-starter#1.2.1~build: PATH: C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\_work\1\s\node_modules\.bin;C:\agents\2.147.1\externals\git\cmd;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\dotnet;C:\npm\prefix;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\ProgramData\Chocolatey\bin;C:\Users\packer\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Docker;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Subversion\bin;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps
9 verbose lifecycle appwork-vue-starter#1.2.1~build: CWD: D:\_work\1\s
10 silly lifecycle appwork-vue-starter#1.2.1~build: Args: [ '/d /s /c', 'vue-cli-service build' ]
11 silly lifecycle appwork-vue-starter#1.2.1~build: Returned: code: 1 signal: null
12 info lifecycle appwork-vue-starter#1.2.1~build: Failed to exec build script
13 verbose stack Error: appwork-vue-starter#1.2.1 build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid appwork-vue-starter#1.2.1
15 verbose cwd D:\_work\1\s
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.15.1
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error appwork-vue-starter#1.2.1 build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the appwork-vue-starter#1.2.1 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
##[error]Error: Npm failed with return code: 1
##[section]Finishing: npm run build
while not a direct answer to your question, when dealing with node on Azure DevOps hosted agents I found that I do get some random errors, so I switched to using a container to build those (inside hosted agents) and all my errors went away:
jobs:
- job: build_server
pool:
vmImage: 'Ubuntu-16.04'
steps:
# build
- script: |
docker run -v $(Build.SourcesDirectory):/npm node:10.15 bash \
-c "cd /npm && npm install && npm run web-build"
# package
- task: Docker#1
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ parameters.registryName }}
imageName: ${{ format('clarity2/{0}/$(Build.SourceBranchName):$(Build.BuildNumber)', parameters.solutionName) }}
includeLatestTag: true
dockerFile: dockerfile
- task: Docker#1
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ parameters.registryName }}
imageName: ${{ format('clarity2/{0}/$(Build.SourceBranchName)', parameters.solutionName) }}
command: push
In the end, it was a case matter under "./Router". On a closer look, the log stated that:
This relative module was not found:
* ./Router in ./src/main.js
The first problem here is that these lines were NOT following each other on the log file, so hard to interpret.
On my machine, "./Router" was correctly named, but on the repo it had a lower case, which confused the build process. Hard to track, though.

brunch build --production fails only in production

Out of the blue build script started to fail. No changes in environment or configs at all. Works fine in dev, fails in prod.
Both dev and prod (both Ubuntus):
$ npm -v
5.3.0
$ node -v
v6.11.2
In dev:
oleg#DevVM ~/Code/loaded.bike/assets $ npm run deploy
> # deploy /home/oleg/Code/loaded.bike/assets
> brunch build --production
17:49:59 - info: compiling
17:49:59 - info: compiled 19 files into 2 files, copied 32 in 6.9 sec
In prod:
deploy#loaded-bike-app:~/builds/assets$ npm run deploy
> # deploy /home/deploy/builds/assets
> brunch build --production
00:45:30 - error: Initialization error - Could not load global module 'jquery'. Possible solution: add 'jquery' to package.json and `npm install`. Could not load global module 'jquery'. Possible solution: add 'jquery' to package.json and `npm install`.
Stack trace was suppressed. Run with `LOGGY_STACKS=1` to see the trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # deploy: `brunch build --production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # deploy 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! /home/deploy/.npm/_logs/2017-08-12T00_45_30_084Z-debug.log
Full log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm#5.3.0
3 info using node#v6.11.2
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle #~predeploy: #
6 info lifecycle #~deploy: #
7 verbose lifecycle #~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle #~deploy: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/deploy/builds/assets/node_modules/.bin:/home/deploy/bin:/home/deploy/.local
/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle #~deploy: CWD: /home/deploy/builds/assets
10 silly lifecycle #~deploy: Args: [ '-c', 'brunch build --production' ]
11 silly lifecycle #~deploy: Returned: code: 1 signal: null
12 info lifecycle #~deploy: Failed to exec deploy script
13 verbose stack Error: # deploy: `brunch build --production`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid #
15 verbose cwd /home/deploy/builds/assets
16 verbose Linux 4.8.0-41-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
18 verbose node v6.11.2
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error # deploy: `brunch build --production`
22 error Exit status 1
23 error Failed at the # deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Adding jquery, tether to package.json fixes require error but then it just chokes on sass compile. Is this just JS missfiring async function out of order or what is going here? Once again, it started to fail completely out of the blue. Deployed just fine yesterday and today if fails without me changing anything. Any clue what might be wrong here?
EDIT:
package.json:
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "6.0.6",
"brunch": "2.10.10",
"clean-css-brunch": "2.10.0",
"css-brunch": "2.10.0",
"sass-brunch": "2.10.4",
"uglify-js-brunch": "2.1.1"
}
}
I'm actually seeing this crap on prod (but not on dev)
npm ERR! peer dep missing: jquery#>=3.0.0, required by bootstrap#4.0.0-beta
npm ERR! peer dep missing: popper.js#^1.11.0, required by bootstrap#4.0.0-beta
What is that about? Bootstrap defines those as dependencies (not peerDependency) in its own package.json. npm doesn't pull in dependencies now?
"bootstrap": "^4.0.0-alpha.6"
Needed to lock the version. Bootstrap went from alpha.6 to beta yesterday. Messed everything up. No idea why is started to fail only on one machine (even after npm cache clear). Sass compile fails under beta, so I locked it to alpha.6 for now.
I think I need to start locking dependency versions. This took way too long to figure out.

ELIFECYCLE npm error

This is the error in my console
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! sedona#0.1.0 start: `npm run build && gulp serve`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the sedona#0.1.0 start 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\User\AppData\Roaming\npm-cache\_logs\2017-07-21T19_40_30_516Z
-debug.log
This is the "debug.log" file from AppData/Roaming etc. path
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#5.3.0
3 info using node#v8.2.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle sedona#0.1.0~prestart: sedona#0.1.0
6 info lifecycle sedona#0.1.0~start: sedona#0.1.0
7 verbose lifecycle sedona#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle sedona#0.1.0~start: PATH: D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\User\Desktop\user.github.io\node_modules\.bin;C:\Users\User\Desktop\cmder\bin;C:\Users\User\Desktop\cmder\vendor\git-for-windows\cmd;C:\Users\User\Desktop\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\User\Desktop\cmder\vendor\conemu-maximus5;C:\Users\User\Desktop\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Calibre2\;C:\Program Files (x86)\Skype\Phone\;D:\Program Files\nodejs\;C:\Users\User\AppData\Roaming\npm;C:\Users\User\Desktop\cmder\vendor\git-for-windows\usr\bin;C:\Users\User\Desktop\cmder\vendor\git-for-windows\usr\share\vim\vim74;C:\Users\User\Desktop\cmder\
9 verbose lifecycle sedona#0.1.0~start: CWD: C:\Users\User\Desktop\user.github.io
10 silly lifecycle sedona#0.1.0~start: Args: [ '/d /s /c', 'npm run build && gulp serve' ]
11 silly lifecycle sedona#0.1.0~start: Returned: code: 3221225477 signal: null
12 info lifecycle sedona#0.1.0~start: Failed to exec start script
13 verbose stack Error: sedona#0.1.0 start: `npm run build && gulp serve`
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (D:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at EventEmitter.emit (events.js:213:7)
13 verbose stack at ChildProcess.<anonymous> (D:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at ChildProcess.emit (events.js:213:7)
13 verbose stack at maybeClose (internal/child_process.js:921:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid sedona#0.1.0
15 verbose cwd C:\Users\user\Desktop\user.github.io
16 verbose Windows_NT 6.1.7601
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.2.1
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 3221225477
22 error sedona#0.1.0 start: `npm run build && gulp serve`
22 error Exit status 3221225477
23 error Failed at the sedona#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
I have already downloaded another gulp-sass projects from other peolpe github's and replace it contains with my own html-sass-js-img files. Error still here btw.
I have already reinstall cmder and node.js. Twice. Error still here.
I have already delete "node-modules" folder from my project and made "npm i" command - nothing changed.
And one fun thing - files in folder "build" updated like always (if you manual lauch them in browser like in old times). But in root folder seems like gulp-sass just don't see that anything happen and zero changes displayed in localhost 3000.
My previous build from yesterday work fine (seemingly) and builds from another people from github work fine too, but why my new build with some changes make that crash??? Only cause sass files changed?
So, there's an interesting cause of this in Jest in VSCode while debugging with Node 12.4.0. When running jest and babel, and placing breakpoints in static classes, the second you place them in the static class, in a static method, node throws this error. To fix, dont write weird static classes.

Resources