Permission denied issue

Issue with deploying the site. Below is the code.

2:12:16 PM: Build ready to start
2:12:19 PM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
2:12:19 PM: build-image tag: v3.3.5
2:12:19 PM: buildbot version: 2fd8f04962d5dbc77b79b9c2f5ab7a077e87376b
2:12:19 PM: Fetching cached dependencies
2:12:19 PM: Starting to download cache of 68.8MB
2:12:20 PM: Finished downloading cache in 960.421849ms
2:12:20 PM: Starting to extract cache
2:12:22 PM: Finished extracting cache in 2.046787534s
2:12:22 PM: Finished fetching cache in 3.044484599s
2:12:22 PM: Starting to prepare the repo for build
2:12:22 PM: Preparing Git Reference refs/heads/cicd
2:12:24 PM: Starting build script
2:12:25 PM: Installing dependencies
2:12:26 PM: Downloading and installing node v10.19.0...
2:12:26 PM: Downloading https://nodejs.org/dist/v10.19.0/node-v10.19.0-linux-x64.tar.xz...
2:12:27 PM: 
##################################
2:12:27 PM:                                     48.1%
2:12:27 PM: 
##################################################################
2:12:27 PM: ###### 100.0%
2:12:27 PM: Computing checksum with sha256sum
2:12:27 PM: Checksums matched!
2:12:30 PM: Now using node v10.19.0 (npm v6.13.4)
2:12:30 PM: Attempting ruby version 2.6.2, read from environment
2:12:31 PM: Using ruby version 2.6.2
2:12:32 PM: Using PHP version 5.6
2:12:32 PM: Started restoring cached node modules
2:12:32 PM: Finished restoring cached node modules
2:12:32 PM: Found npm version (6.13.4) that doesn't match expected (6.4.1)
2:12:32 PM: Installing npm at version 6.4.1
2:12:40 PM: /opt/buildhome/.nvm/versions/node/v10.19.0/bin/npm -> /opt/buildhome/.nvm/versions/node/v10.19.0/lib/node_modules/npm/bin/npm-cli.js
2:12:40 PM: /opt/buildhome/.nvm/versions/node/v10.19.0/bin/npx -> /opt/buildhome/.nvm/versions/node/v10.19.0/lib/node_modules/npm/bin/npx-cli.js
2:12:40 PM: + npm@6.4.1
2:12:40 PM: added 22 packages from 11 contributors, removed 65 packages and updated 72 packages in 7.518s
2:12:40 PM: NPM installed successfully
2:12:41 PM: Installing NPM modules using NPM version 6.4.1
2:12:42 PM: npm
2:12:42 PM:  WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
2:12:44 PM: npm notice
2:12:44 PM:  created a lockfile as package-lock.json. You should commit this file.
2:12:44 PM: npm
2:12:44 PM: WARN startuphack@ No description
2:12:44 PM: npm WARN
2:12:44 PM:  startuphack@ No repository field.
2:12:44 PM: added 51 packages from 60 contributors and audited 68 packages in 2.159s
2:12:44 PM: found 0 vulnerabilities
2:12:44 PM: NPM modules installed
2:12:44 PM: Started restoring cached go cache
2:12:44 PM: Finished restoring cached go cache
2:12:44 PM: unset GOOS;
2:12:44 PM: unset GOARCH;
2:12:44 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
2:12:44 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
2:12:44 PM: go version >&2;
2:12:44 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
2:12:44 PM: go version go1.12 linux/amd64
2:12:44 PM: Installing missing commands
2:12:44 PM: Verify run directory
2:12:44 PM: Executing user command: npm run build
2:12:44 PM: > startuphack@ build /opt/build/repo
2:12:44 PM: > node ./js/scripts/build
2:12:45 PM: /opt/build/repo/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:49
2:12:45 PM:           throw err0
2:12:45 PM:           ^
2:12:45 PM: Error: EACCES: permission denied, mkdir '/news'
2:12:45 PM:     at Object.mkdirSync (fs.js:757:3)
2:12:45 PM:     at Object.mkdirsSync (/opt/build/repo/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
2:12:45 PM:     at Object.emptyDirSync (/opt/build/repo/node_modules/fs-extra/lib/empty/index.js:34:18)
2:12:45 PM:     at Object.<anonymous> (/opt/build/repo/js/scripts/build.js:50:5)
2:12:45 PM:     at Module._compile (internal/modules/cjs/loader.js:778:30)
2:12:45 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2:12:45 PM:     at Module.load (internal/modules/cjs/loader.js:653:32)
2:12:45 PM:     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2:12:45 PM:     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2:12:45 PM:     at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
2:12:45 PM: npm
2:12:45 PM:  ERR!
2:12:45 PM: code ELIFECYCLE
2:12:45 PM: npm
2:12:45 PM: ERR! errno 1
2:12:45 PM: npm ERR!
2:12:45 PM:  startuphack@ build: `node ./js/scripts/build`
2:12:45 PM: npm
2:12:45 PM: ERR! Exit status 1
2:12:45 PM: npm
2:12:45 PM: ERR!
2:12:45 PM: npm
2:12:45 PM:  ERR! Failed at the startuphack@ build script.
2:12:45 PM: npm
2:12:45 PM: ERR! This is probably not a problem with npm. There is likely additional logging output above.
2:12:45 PM: npm
2:12:45 PM:  ERR!
2:12:45 PM:  A complete log of this run can be found in:
2:12:45 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-02-14T08_42_45_012Z-debug.log
2:12:45 PM: Skipping functions preparation step: no functions directory set
2:12:45 PM: Caching artifacts
2:12:45 PM: Started saving node modules
2:12:45 PM: Finished saving node modules
2:12:45 PM: Started saving pip cache
2:12:45 PM: Finished saving pip cache
2:12:45 PM: Started saving emacs cask dependencies
2:12:45 PM: Finished saving emacs cask dependencies
2:12:45 PM: Started saving maven dependencies
2:12:45 PM: Finished saving maven dependencies
2:12:45 PM: Started saving boot dependencies
2:12:45 PM: Finished saving boot dependencies
2:12:45 PM: Started saving go dependencies
2:12:45 PM: Finished saving go dependencies
2:12:48 PM: Error running command: Build script returned non-zero exit code: 1
2:12:48 PM: Failing build: Failed to build site
2:12:48 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
2:12:48 PM: Finished processing build request in 29.089856369s

The issue was with the path I used for saving the files. I was using absolute path instead of relative path.

Hi, @SUKHI-AATMA. Thank you for sharing your question and the solution you found here. Also, welcome to our Netlify community site. :+1:

If there are other questions for us, please let us know.