Azure / Azure/static-web-apps

React App - Failing to deploy with node 16 - [Error: EACCES: permission denied, scandir '/root/.npm/_logs'

Open
#909 25 comments 0 reactions 0 assignees View on GitHub
oryx triaged
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 DeploymentId: 204e35fc-21f5-4d85-944d-75d208ada2ff
2022-09-02T11:06:59.3772538Z 
2022-09-02T11:06:59.4537385Z Verbose logging enabled
2022-09-02T11:06:59.4993886Z Build timeout not specified, defaulting to 15 minutes
2022-09-02T11:06:59.4994815Z App Directory Location: '/' was found.
2022-09-02T11:06:59.4996124Z Looking for event info
2022-09-02T11:06:59.5012319Z Event info parsed from action options.
2022-09-02T11:07:00.5845291Z Starting to build app with Oryx
2022-09-02T11:07:00.5852884Z Azure 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
2022-09-02T11:07:00.5853845Z Calling 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"
2022-09-02T11:07:00.5854420Z ---Oryx build logs---
2022-09-02T11:07:00.5854755Z 
2022-09-02T11:07:00.5855045Z 
2022-09-02T11:07:01.0909240Z Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
2022-09-02T11:07:01.0909961Z You can report issues at https://github.com/Microsoft/Oryx/issues
2022-09-02T11:07:01.0910365Z 
2022-09-02T11:07:01.0912691Z Oryx Version: 0.2.20220621.1, Commit: 82ed84f0f3fd3a25ded3029f137601f54e7a1d05, ReleaseTagName: 20220621.1
2022-09-02T11:07:01.0913161Z 
2022-09-02T11:07:01.0916063Z Build Operation ID: |m260hWPwEq0=.7d5ee18c_
2022-09-02T11:07:01.0916679Z Repository Commit : c4d014096879c900ec801aaa1d27e599b550a3b9
2022-09-02T11:07:01.0917345Z 
2022-09-02T11:07:01.1111855Z Detecting platforms...
2022-09-02T11:07:02.6742889Z Detected following platforms:
2022-09-02T11:07:02.6744944Z  nodejs: 16.14.2
2022-09-02T11:07:02.6791798Z Version '16.14.2' of platform 'nodejs' is not installed. Generating script to install it...
2022-09-02T11:07:02.7431652Z Detected the following frameworks: React
2022-09-02T11:07:02.8643197Z 
2022-09-02T11:07:02.8716828Z 
2022-09-02T11:07:02.8725715Z Source directory : /working_dir
2022-09-02T11:07:02.8726167Z Destination directory: /ss-oryx/app
2022-09-02T11:07:02.8726516Z 
2022-09-02T11:07:02.8726804Z 
2022-09-02T11:07:02.8727259Z Downloading and extracting 'nodejs' version '16.14.2' to '/opt/nodejs/16.14.2'...
2022-09-02T11:07:03.2974116Z Downloaded in 1 sec(s).
2022-09-02T11:07:03.2974630Z Verifying checksum...
2022-09-02T11:07:03.3035492Z Extracting contents...
2022-09-02T11:07:04.2374414Z performing sha512 checksum for: nodejs...
2022-09-02T11:07:04.3804349Z Done in 2 sec(s).
2022-09-02T11:07:04.3815274Z 
2022-09-02T11:07:04.4382124Z Removing existing manifest file
2022-09-02T11:07:04.4412840Z Creating directory for command manifest file if it does not exist
2022-09-02T11:07:04.4439828Z Creating a manifest file...
2022-09-02T11:07:04.4469259Z Node Build Command Manifest file created.
2022-09-02T11:07:04.4471095Z 
2022-09-02T11:07:04.4471877Z Using Node version:
2022-09-02T11:07:04.4504087Z v16.14.2
2022-09-02T11:07:04.4514718Z 
2022-09-02T11:07:04.4520131Z Using Npm version:
2022-09-02T11:07:04.7470201Z 8.5.0
2022-09-02T11:07:04.7634609Z 
2022-09-02T11:07:04.7635068Z Running 'npm install --unsafe-perm'...
2022-09-02T11:07:04.7635432Z 
2022-09-02T11:07:56.7099103Z npm 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
2022-09-02T11:07:57.0985456Z npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
2022-09-02T11:08:07.4940329Z npm 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.)
2022-09-02T11:08:08.6199055Z npm 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)
2022-09-02T11:08:10.5386300Z npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
2022-09-02T11:08:22.7751626Z npm ERR! code 1
2022-09-02T11:08:22.7803155Z npm ERR! path /working_dir/node_modules/keytar
2022-09-02T11:08:22.7803627Z npm ERR! command failed
2022-09-02T11:08:22.7804075Z npm ERR! command sh -c prebuild-install || npm run build
2022-09-02T11:08:22.7804514Z npm ERR! > keytar@7.9.0 build
2022-09-02T11:08:22.7804899Z npm ERR! > node-gyp rebuild
2022-09-02T11:08:22.7805406Z npm ERR! prebuild-install warn install EACCES: permission denied, access '/root/.npm'
2022-09-02T11:08:22.7805975Z npm ERR! glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
2022-09-02T11:08:22.7806428Z npm ERR! errno: -13,
2022-09-02T11:08:22.7806796Z npm ERR! code: 'EACCES',
2022-09-02T11:08:22.7807182Z npm ERR! syscall: 'scandir',
2022-09-02T11:08:22.7807583Z npm ERR! path: '/root/.npm/_logs'
2022-09-02T11:08:22.7807936Z npm ERR! }
2022-09-02T11:08:22.7808418Z npm ERR! npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
2022-09-02T11:08:22.7809330Z npm ERR! npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
2022-09-02T11:08:22.7809877Z npm ERR! npm WARN logfile errno: -13,
2022-09-02T11:08:22.7810308Z npm ERR! npm WARN logfile code: 'EACCES',
2022-09-02T11:08:22.7810757Z npm ERR! npm WARN logfile syscall: 'scandir',
2022-09-02T11:08:22.7811208Z npm ERR! npm WARN logfile path: '/root/.npm/_logs'
2022-09-02T11:08:22.7811626Z npm ERR! npm WARN logfile }
2022-09-02T11:08:22.7812038Z npm ERR! gyp info it worked if it ends with ok
2022-09-02T11:08:22.7812463Z npm ERR! gyp info using node-gyp@8.4.1
2022-09-02T11:08:22.7812917Z npm ERR! gyp info using node@16.14.2 | linux | x64
2022-09-02T11:08:22.7813464Z npm ERR! gyp info find Python using Python version 3.8.12 found at "/opt/python/latest/bin/python3"
2022-09-02T11:08:22.7814138Z npm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/16.14.2"
2022-09-02T11:08:22.7814757Z npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
2022-09-02T11:08:22.7815370Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz
2022-09-02T11:08:22.7815990Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz
2022-09-02T11:08:22.7816589Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.14.2/SHASUMS256.txt
2022-09-02T11:08:22.7817153Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.14.2/SHASUMS256.txt
2022-09-02T11:08:22.7817671Z npm ERR! gyp info spawn /opt/python/latest/bin/python3
2022-09-02T11:08:22.7818086Z npm ERR! gyp info spawn args [
2022-09-02T11:08:22.7818647Z npm ERR! gyp info spawn args '/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
2022-09-02T11:08:22.7819183Z npm ERR! gyp info spawn args 'binding.gyp',
2022-09-02T11:08:22.7819600Z npm ERR! gyp info spawn args '-f',
2022-09-02T11:08:22.7820011Z npm ERR! gyp info spawn args 'make',
2022-09-02T11:08:22.7820417Z npm ERR! gyp info spawn args '-I',
2022-09-02T11:08:22.7820921Z npm ERR! gyp info spawn args '/working_dir/node_modules/keytar/build/config.gypi',
2022-09-02T11:08:22.7821392Z npm ERR! gyp info spawn args '-I',
2022-09-02T11:08:22.7821951Z npm ERR! gyp info spawn args '/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
2022-09-02T11:08:22.7822455Z npm ERR! gyp info spawn args '-I',
2022-09-02T11:08:22.7822961Z npm ERR! gyp info spawn args '/tmp/.node-gyp/16.14.2/include/node/common.gypi',
2022-09-02T11:08:22.7823621Z npm ERR! gyp info spawn args '-Dlibrary=shared_library',
2022-09-02T11:08:22.7824131Z npm ERR! gyp info spawn args '-Dvisibility=default',
2022-09-02T11:08:22.7824643Z npm ERR! gyp info spawn args '-Dnode_root_dir=/tmp/.node-gyp/16.14.2',
2022-09-02T11:08:22.7825252Z npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/nodejs/16.14.2/lib/node_modules/npm/node_modules/node-gyp',
2022-09-02T11:08:22.7825891Z npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/16.14.2/<(target_arch)/node.lib',
2022-09-02T11:08:22.7826484Z npm ERR! gyp info spawn args '-Dmodule_root_dir=/working_dir/node_modules/keytar',
2022-09-02T11:08:22.7826995Z npm ERR! gyp info spawn args '-Dnode_engine=v8',
2022-09-02T11:08:22.7827437Z npm ERR! gyp info spawn args '--depth=.',
2022-09-02T11:08:22.7827879Z npm ERR! gyp info spawn args '--no-parallel',
2022-09-02T11:08:22.7828333Z npm ERR! gyp info spawn args '--generator-output',
2022-09-02T11:08:22.7828775Z npm ERR! gyp info spawn args 'build',
2022-09-02T11:08:22.7829337Z npm ERR! gyp info spawn args '-Goutput_dir=.'
2022-09-02T11:08:22.7829742Z npm ERR! gyp info spawn args ]
2022-09-02T11:08:22.7830226Z npm ERR! Package libsecret-1 was not found in the pkg-config search path.
2022-09-02T11:08:22.7830757Z npm ERR! Perhaps you should add the directory containing `libsecret-1.pc'
2022-09-02T11:08:22.7831267Z npm ERR! to the PKG_CONFIG_PATH environment variable
2022-09-02T11:08:22.7831703Z npm ERR! No package 'libsecret-1' found
2022-09-02T11:08:22.7832340Z npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
2022-09-02T11:08:22.7832875Z npm ERR! gyp ERR! configure error 
2022-09-02T11:08:22.7833343Z npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
2022-09-02T11:08:22.7834020Z npm 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)
2022-09-02T11:08:22.7834713Z npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
2022-09-02T11:08:22.7835386Z npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
2022-09-02T11:08:22.7835981Z npm ERR! gyp ERR! System Linux 5.15.0-1017-azure
2022-09-02T11:08:22.7836624Z npm 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"
2022-09-02T11:08:22.7837216Z npm ERR! gyp ERR! cwd /working_dir/node_modules/keytar
2022-09-02T11:08:22.7837658Z npm ERR! gyp ERR! node -v v16.14.2
2022-09-02T11:08:22.7838066Z npm ERR! gyp ERR! node-gyp -v v8.4.1
2022-09-02T11:08:22.7838454Z npm ERR! gyp ERR! not ok
2022-09-02T11:08:22.7838771Z 
2022-09-02T11:08:22.7839172Z npm ERR! A complete log of this run can be found in:
2022-09-02T11:08:22.7839677Z npm ERR! /root/.npm/_logs/2022-09-02T11_07_04_900Z-debug-0.log
2022-09-02T11:08:24.1090109Z 
2022-09-02T11:08:24.1090514Z 
2022-09-02T11:08:24.1094400Z ---End of Oryx build logs---
2022-09-02T11:08:24.1094897Z Oryx build has completed. Took 83.5233133 seconds. Exit Code: 1
2022-09-02T11:08:24.1095439Z Oryx has failed to build the solution.
2022-09-02T11:08:24.2212008Z 
2022-09-02T11:08:24.2212694Z For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
2022-09-02T11:08:24.2213436Z If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
2022-09-02T11:08:24.2213924Z Exiting
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.