React App - Failing to deploy with node 16 - [Error: EACCES: permission denied, scandir '/root/.npm/_logs'
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Hi All,
Our Azure pipeline fails when attempting to deploy a React based SWA with node 16 (although it has historically worked ok with node 14)
**To Reproduce**
Trigger the Azure pipeline with the following build yaml
```
name: Azure Static Web Apps CI/CD for Staging envs
trigger:
- develop
- gamma
- theta
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
app_location: "/"
api_location: "api"
verbose: true
output_location: "build"
production_branch: "main"
env:
azure_static_web_apps_api_token: $(deploymentToken)
```
*package.json*
```
{
"name": "iqgen-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@azure/msal-browser": "^2.24.0",
"@azure/msal-react": "^1.4.0",
"@tanstack/react-query": "^4.0.10",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"bootstrap": "^5.1.3",
"react": "^18.1.0",
"react-bootstrap": "^2.4.0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4",
"xlsx": "^0.18.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"preswa": "react-scripts build",
"swa": "swa start build --api-location api"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": "^16.14.2"
},
"description": "Simple database and UX",
"main": "index.js",
"devDependencies": {
"@azure/static-web-apps-cli": "^1.0.2",
"azure-functions-core-tools": "^4.0.4629",
"concurrently": "^7.2.2",
"prettier": "2.7.1"
},
"repository": {
"type": "git",
"url": "https://notme@dev.azure.com/notme/IQGen/_git/IQGen"
},
"keywords": [],
"author": "",
"license": "ISC"
}
```
*staticwebapp.config.json*
```
...
{"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["*.{css,scss,js,png,gif,ico,jpg,svg}"]
}
}
```
**The output from the build is as follows:**
```
2022-09-02T11:06:10.8925019Z ##[section]Starting: AzureStaticWebApp
2022-09-02T11:06:10.8930946Z ==============================================================================
2022-09-02T11:06:10.8931219Z Task : Deploy Azure Static Web App
2022-09-02T11:06:10.8931467Z Description : [PREVIEW] Build and deploy an Azure Static Web App
2022-09-02T11:06:10.8931686Z Version : 0.203.0
2022-09-02T11:06:10.8931856Z Author : Microsoft Corporation
2022-09-02T11:06:10.8932052Z Help : https://aka.ms/swadocs
2022-09-02T11:06:10.8932291Z ==============================================================================
2022-09-02T11:06:11.1710397Z [command]/usr/bin/bash /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.203.0/launch-docker.sh
2022-09-02T11:06:11.4457014Z stable: Pulling from appsvc/staticappsclient
...
2022-09-02T11:06:58.9578211Z Digest: sha256:aee830ea88cd1a1c6dbe248e0a9613c60e27fd960c95170e2eadeb6355e8366b
2022-09-02T11:06:58.9597279Z Status: Downloaded newer image for mcr.microsoft.com/appsvc/staticappsclient:stable
2022-09-02T11:06:59.3771748Z [37mDeploymentId: 204e35fc-21f5-4d85-944d-75d208ada2ff[0m
2022-09-02T11:06:59.3772538Z [37m[0m
2022-09-02T11:06:59.4537385Z [37mVerbose logging enabled[0m
2022-09-02T11:06:59.4993886Z [37mBuild timeout not specified, defaulting to 15 minutes[0m
2022-09-02T11:06:59.4994815Z [37mApp Directory Location: '/' was found.[0m
2022-09-02T11:06:59.4996124Z [37mLooking for event info[0m
2022-09-02T11:06:59.5012319Z [37mEvent info parsed from action options.[0m
2022-09-02T11:07:00.5845291Z [37mStarting to build app with Oryx[0m
2022-09-02T11:07:00.5852884Z [33mAzure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx[0m
2022-09-02T11:07:00.5853845Z [37mCalling oryx build "/working_dir" -o /ss-oryx/app --manifest-dir /ss-oryx/app-manifest -p require_build -p disable_recursive_lookup=true -p ORYX_APP_TYPE="static-sites"[0m
2022-09-02T11:07:00.5854420Z [37m---Oryx build logs---[0m
2022-09-02T11:07:00.5854755Z [37m[0m
2022-09-02T11:07:00.5855045Z [37m[0m
2022-09-02T11:07:01.0909240Z [37mOperation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx[0m
2022-09-02T11:07:01.0909961Z [37mYou can report issues at https://github.com/Microsoft/Oryx/issues[0m
2022-09-02T11:07:01.0910365Z [37m[0m
2022-09-02T11:07:01.0912691Z [37mOryx Version: 0.2.20220621.1, Commit: 82ed84f0f3fd3a25ded3029f137601f54e7a1d05, ReleaseTagName: 20220621.1[0m
2022-09-02T11:07:01.0913161Z [37m[0m
2022-09-02T11:07:01.0916063Z [37mBuild Operation ID: |m260hWPwEq0=.7d5ee18c_[0m
2022-09-02T11:07:01.0916679Z [37mRepository Commit : c4d014096879c900ec801aaa1d27e599b550a3b9[0m
2022-09-02T11:07:01.0917345Z [37m[0m
2022-09-02T11:07:01.1111855Z [37mDetecting platforms...[0m
2022-09-02T11:07:02.6742889Z [37mDetected following platforms:[0m
2022-09-02T11:07:02.6744944Z [37m nodejs: 16.14.2[0m
2022-09-02T11:07:02.6791798Z [37mVersion '16.14.2' of platform 'nodejs' is not installed. Generating script to install it...[0m
2022-09-02T11:07:02.7431652Z [37mDetected the following frameworks: React[0m
2022-09-02T11:07:02.8643197Z [37m[0m
2022-09-02T11:07:02.8716828Z [37m[0m
2022-09-02T11:07:02.8725715Z [37mSource directory : /working_dir[0m
2022-09-02T11:07:02.8726167Z [37mDestination directory: /ss-oryx/app[0m
2022-09-02T11:07:02.8726516Z [37m[0m
2022-09-02T11:07:02.8726804Z [37m[0m
2022-09-02T11:07:02.8727259Z [37mDownloading and extracting 'nodejs' version '16.14.2' to '/opt/nodejs/16.14.2'...[0m
2022-09-02T11:07:03.2974116Z [37mDownloaded in 1 sec(s).[0m
2022-09-02T11:07:03.2974630Z [37mVerifying checksum...[0m
2022-09-02T11:07:03.3035492Z [37mExtracting contents...[0m
2022-09-02T11:07:04.2374414Z [37mperforming sha512 checksum for: nodejs...[0m
2022-09-02T11:07:04.3804349Z [37mDone in 2 sec(s).[0m
2022-09-02T11:07:04.3815274Z [37m[0m
2022-09-02T11:07:04.4382124Z [37mRemoving existing manifest file[0m
2022-09-02T11:07:04.4412840Z [37mCreating directory for command manifest file if it does not exist[0m
2022-09-02T11:07:04.4439828Z [37mCreating a manifest file...[0m
2022-09-02T11:07:04.4469259Z [37mNode Build Command Manifest file created.[0m
2022-09-02T11:07:04.4471095Z [37m[0m
2022-09-02T11:07:04.4471877Z [37mUsing Node version:[0m
2022-09-02T11:07:04.4504087Z [37mv16.14.2[0m
2022-09-02T11:07:04.4514718Z [37m[0m
2022-09-02T11:07:04.4520131Z [37mUsing Npm version:[0m
2022-09-02T11:07:04.7470201Z [37m8.5.0[0m
2022-09-02T11:07:04.7634609Z [37m[0m
2022-09-02T11:07:04.7635068Z [37mRunning 'npm install --unsafe-perm'...[0m
2022-09-02T11:07:04.7635432Z [37m[0m
2022-09-02T11:07:56.7099103Z [31mnpm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility[0m
2022-09-02T11:07:57.0985456Z [31mnpm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated[0m
2022-09-02T11:08:07.4940329Z [31mnpm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)[0m
2022-09-02T11:08:08.6199055Z [31mnpm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)[0m
2022-09-02T11:08:10.5386300Z [31mnpm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.[0m
2022-09-02T11:08:22.7751626Z [31mnpm ERR! code 1[0m
2022-09-02T11:08:22.7803155Z [31mnpm ERR! path /working_dir/node_modules/keytar[0m
2022-09-02T11:08:22.7803627Z [31mnpm ERR! command failed[0m
2022-09-02T11:08:22.7804075Z [31mnpm ERR! command sh -c prebuild-install || npm run build[0m
2022-09-02T11:08:22.7804514Z [31mnpm ERR! > keytar@7.9.0 build[0m
2022-09-02T11:08:22.7804899Z [31mnpm ERR! > node-gyp rebuild[0m
2022-09-02T11:08:22.7805406Z [31mnpm ERR! prebuild-install warn install EACCES: permission denied, access '/root/.npm'[0m
2022-09-02T11:08:22.7805975Z [31mnpm ERR! glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {[0m
2022-09-02T11:08:22.7806428Z [31mnpm ERR! errno: -13,[0m
2022-09-02T11:08:22.7806796Z [31mnpm ERR! code: 'EACCES',[0m
2022-09-02T11:08:22.7807182Z [31mnpm ERR! syscall: 'scandir',[0m
2022-09-02T11:08:22.7807583Z [31mnpm ERR! path: '/root/.npm/_logs'[0m
2022-09-02T11:08:22.7807936Z [31mnpm ERR! }[0m
2022-09-02T11:08:22.7808418Z [31mnpm ERR! npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'[0m
2022-09-02T11:08:22.7809330Z [31mnpm ERR! npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {[0m
2022-09-02T11:08:22.7809877Z [31mnpm ERR! npm WARN logfile errno: -13,[0m
2022-09-02T11:08:22.7810308Z [31mnpm ERR! npm WARN logfile code: 'EACCES',[0m
2022-09-02T11:08:22.7810757Z [31mnpm ERR! npm WARN logfile syscall: 'scandir',[0m
2022-09-02T11:08:22.7811208Z [31mnpm ERR! npm WARN logfile path: '/root/.npm/_logs'[0m
2022-09-02T11:08:22.7811626Z [31mnpm ERR! npm WARN logfile }[0m
2022-09-02T11:08:22.7812038Z [31mnpm ERR! gyp info it worked if it ends with ok[0m
2022-09-02T11:08:22.7812463Z [31mnpm ERR! gyp info using node-gyp@8.4.1[0m
2022-09-02T11:08:22.7812917Z [31mnpm ERR! gyp info using node@16.14.2 | linux | x64[0m
2022-09-02T11:08:22.7813464Z [31mnpm ERR! gyp info find Python using Python version 3.8.12 found at "/opt/python/latest/bin/python3"[0m
2022-09-02T11:08:22.7814138Z [31mnpm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/16.14.2"[0m
2022-09-02T11:08:22.7814757Z [31mnpm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"[0m
2022-09-02T11:08:22.7815370Z [31mnpm ERR! gyp http GET https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz[0m
2022-09-02T11:08:22.7815990Z [31mnpm ERR! gyp http 200 https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz[0m
2022-09-02T11:08:22.7816589Z [31mnpm ERR! gyp http GET https://nodejs.org/download/release/v16.14.2/SHASUMS256.txt[0m
2022-09-02T11:08:22.7817153Z [31mnpm ERR! gyp http 200 https://nodejs.org/download/release/v16.14.2/SHASUMS256.txt[0m
2022-09-02T11:08:22.7817671Z [31mnpm ERR! gyp info spawn /opt/python/latest/bin/python3[0m
2022-09-02T11:08:22.7818086Z [31mnpm ERR! gyp info spawn args [[0m
2022-09-02T11:08:22.7818647Z [31mnpm ERR! gyp info spawn args '/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',[0m
2022-09-02T11:08:22.7819183Z [31mnpm ERR! gyp info spawn args 'binding.gyp',[0m
2022-09-02T11:08:22.7819600Z [31mnpm ERR! gyp info spawn args '-f',[0m
2022-09-02T11:08:22.7820011Z [31mnpm ERR! gyp info spawn args 'make',[0m
2022-09-02T11:08:22.7820417Z [31mnpm ERR! gyp info spawn args '-I',[0m
2022-09-02T11:08:22.7820921Z [31mnpm ERR! gyp info spawn args '/working_dir/node_modules/keytar/build/config.gypi',[0m
2022-09-02T11:08:22.7821392Z [31mnpm ERR! gyp info spawn args '-I',[0m
2022-09-02T11:08:22.7821951Z [31mnpm ERR! gyp info spawn args '/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',[0m
2022-09-02T11:08:22.7822455Z [31mnpm ERR! gyp info spawn args '-I',[0m
2022-09-02T11:08:22.7822961Z [31mnpm ERR! gyp info spawn args '/tmp/.node-gyp/16.14.2/include/node/common.gypi',[0m
2022-09-02T11:08:22.7823621Z [31mnpm ERR! gyp info spawn args '-Dlibrary=shared_library',[0m
2022-09-02T11:08:22.7824131Z [31mnpm ERR! gyp info spawn args '-Dvisibility=default',[0m
2022-09-02T11:08:22.7824643Z [31mnpm ERR! gyp info spawn args '-Dnode_root_dir=/tmp/.node-gyp/16.14.2',[0m
2022-09-02T11:08:22.7825252Z [31mnpm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp',[0m
2022-09-02T11:08:22.7825891Z [31mnpm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/16.14.2/<(target_arch)/node.lib',[0m
2022-09-02T11:08:22.7826484Z [31mnpm ERR! gyp info spawn args '-Dmodule_root_dir=/working_dir/node_modules/keytar',[0m
2022-09-02T11:08:22.7826995Z [31mnpm ERR! gyp info spawn args '-Dnode_engine=v8',[0m
2022-09-02T11:08:22.7827437Z [31mnpm ERR! gyp info spawn args '--depth=.',[0m
2022-09-02T11:08:22.7827879Z [31mnpm ERR! gyp info spawn args '--no-parallel',[0m
2022-09-02T11:08:22.7828333Z [31mnpm ERR! gyp info spawn args '--generator-output',[0m
2022-09-02T11:08:22.7828775Z [31mnpm ERR! gyp info spawn args 'build',[0m
2022-09-02T11:08:22.7829337Z [31mnpm ERR! gyp info spawn args '-Goutput_dir=.'[0m
2022-09-02T11:08:22.7829742Z [31mnpm ERR! gyp info spawn args ][0m
2022-09-02T11:08:22.7830226Z [31mnpm ERR! Package libsecret-1 was not found in the pkg-config search path.[0m
2022-09-02T11:08:22.7830757Z [31mnpm ERR! Perhaps you should add the directory containing `libsecret-1.pc'[0m
2022-09-02T11:08:22.7831267Z [31mnpm ERR! to the PKG_CONFIG_PATH environment variable[0m
2022-09-02T11:08:22.7831703Z [31mnpm ERR! No package 'libsecret-1' found[0m
2022-09-02T11:08:22.7832340Z [31mnpm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp[0m
2022-09-02T11:08:22.7832875Z [31mnpm ERR! gyp ERR! configure error [0m
2022-09-02T11:08:22.7833343Z [31mnpm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1[0m
2022-09-02T11:08:22.7834020Z [31mnpm ERR! gyp ERR! stack at ChildProcess.onCpExit (/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:259:16)[0m
2022-09-02T11:08:22.7834713Z [31mnpm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)[0m
2022-09-02T11:08:22.7835386Z [31mnpm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)[0m
2022-09-02T11:08:22.7835981Z [31mnpm ERR! gyp ERR! System Linux 5.15.0-1017-azure[0m
2022-09-02T11:08:22.7836624Z [31mnpm ERR! gyp ERR! command "/opt/nodejs/16.14.2/bin/node" "/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"[0m
2022-09-02T11:08:22.7837216Z [31mnpm ERR! gyp ERR! cwd /working_dir/node_modules/keytar[0m
2022-09-02T11:08:22.7837658Z [31mnpm ERR! gyp ERR! node -v v16.14.2[0m
2022-09-02T11:08:22.7838066Z [31mnpm ERR! gyp ERR! node-gyp -v v8.4.1[0m
2022-09-02T11:08:22.7838454Z [31mnpm ERR! gyp ERR! not ok[0m
2022-09-02T11:08:22.7838771Z [31m[0m
2022-09-02T11:08:22.7839172Z [31mnpm ERR! A complete log of this run can be found in:[0m
2022-09-02T11:08:22.7839677Z [31mnpm ERR! /root/.npm/_logs/2022-09-02T11_07_04_900Z-debug-0.log[0m
2022-09-02T11:08:24.1090109Z [37m[0m
2022-09-02T11:08:24.1090514Z [37m[0m
2022-09-02T11:08:24.1094400Z [37m---End of Oryx build logs---[0m
2022-09-02T11:08:24.1094897Z [37mOryx build has completed. Took 83.5233133 seconds. Exit Code: 1[0m
2022-09-02T11:08:24.1095439Z [31mOryx has failed to build the solution.[0m
2022-09-02T11:08:24.2212008Z [37m[0m
2022-09-02T11:08:24.2212694Z [33mFor further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/[0m
2022-09-02T11:08:24.2213436Z [33mIf you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/[0m
2022-09-02T11:08:24.2213924Z [33mExiting[0m
2022-09-02T11:08:24.5662356Z ##[error]Error: The process '/usr/bin/bash' failed with exit code 1
2022-09-02T11:08:24.5736542Z ##[section]Finishing: AzureStaticWebApp
```
Any help appreciated
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.