0

I create a new app service with windows os, connect it to bitbucket and it checks out the code then fails on npm install. I feel like it should work and I cant understand how it is not working..

I put full error traces at the bottom.

First I got this error:

Cannot find module 'sync-exec'

Well that seems like it is using the old node (my package.json has "engines": { "node": "8.9.x" } ) which I thought would be valid so I tried setting the environment variable WEBSITE_NODE_DEFAULT_VERSION to 8.9.0 but it still errors this time with this:

EPERM: operation not permitted, scandir

I read in some posts to try running npm cache clean it says it should auto-clean so from the console I try npm cache clean --force then I rebuild and still get the error. Out of desparation I try del /s /q node_modules then rebuild and now get a worse error.

Cannot read property '0' of undefined

Maybe delete this folder was crazy. If I need I can delete the web app and start over though. I created a linux web app and the npm install worked fine but I have other issues with linux so it would be good to get the windows one working.

Here are the full log outputs:

Selected node.js version 8.9.0. Use package.json file to choose a different version.
Selected npm version 5.5.1
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml
npm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\0.10.28\node.exe but npm is using D:\Program Files (x86)\nodejs\8.9.0\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] install D:\home\site\wwwroot\node_modules\microtime
> prebuild-install || node-gyp rebuild

prebuild-install info begin Prebuild-install version 2.2.1
prebuild-install info looking for local prebuild @ prebuilds\microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install info looking for cached prebuild @ D:\local\AppData\npm-cache\_prebuilds\https-github.com-wadey-node-microtime-releases-download-v2.1.6-microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install http request GET https://github.com/wadey/node-microtime/releases/download/v2.1.6/microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install http 200 https://github.com/wadey/node-microtime/releases/download/v2.1.6/microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install info downloading to @ D:\local\AppData\npm-cache\_prebuilds\https-github.com-wadey-node-microtime-releases-download-v2.1.6-microtime-v2.1.6-node-v11-win32-ia32.tar.gz.5612-28c7359.tmp
prebuild-install info renaming to @ D:\local\AppData\npm-cache\_prebuilds\https-github.com-wadey-node-microtime-releases-download-v2.1.6-microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install info unpacking @ D:\local\AppData\npm-cache\_prebuilds\https-github.com-wadey-node-microtime-releases-download-v2.1.6-microtime-v2.1.6-node-v11-win32-ia32.tar.gz
prebuild-install info unpack resolved to D:\home\site\wwwroot\node_modules\microtime\build\Release\microtime.node
prebuild-install info unpack required D:\home\site\wwwroot\node_modules\microtime\build\Release\microtime.node successfully
prebuild-install info install Successfully installed prebuilt binary!

> [email protected] install D:\home\site\wwwroot\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-ia32-11_binding.node
Download complete
Binary saved to D:\home\site\wwwroot\node_modules\node-sass\vendor\win32-ia32-11\binding.node
Caching binary to D:\local\AppData\npm-cache\node-sass\4.5.3\win32-ia32-11_binding.node

> [email protected] postinstall D:\home\site\wwwroot\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js


module.js:340
    throw err;
          ^
Error: Cannot find module 'sync-exec'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\webpack\node_modules\uglifyjs-webpack-plugin\lib\post_install.js:9:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
npm WARN Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\webpack\node_modules\uglify-js\node_modules'
npm WARN  { Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\webpack\node_modules\uglify-js\node_modules'
npm WARN   stack: 'Error: EPERM: operation not permitted, scandir \'D:\\home\\site\\wwwroot\\node_modules\\webpack\\node_modules\\uglify-js\\node_modules\'',
npm WARN   errno: -4048,
npm WARN   code: 'EPERM',
npm WARN   syscall: 'scandir',
npm WARN   path: 'D:\\home\\site\\wwwroot\\node_modules\\webpack\\node_modules\\uglify-js\\node_modules' }
npm ERR! code ELIFECYCLE
npm ERR! errno 8
npm ERR! [email protected] postinstall: `node lib/post_install.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] postinstall 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!     D:\local\AppData\npm-cache\_logs\2017-11-22T04_03_47_200Z-debug.log
Failed exitCode=8, command="D:\Program Files (x86)\nodejs\8.9.0\node.exe" "D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\npm-cli.js" install --production

After setting the version environment variable the error is:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Start script "built/project1/server.js" from package.json is not found.
Missing server.js/app.js files, web.config is not generated
Looking for app.js/server.js under site root.
Node.js versions available on the platform are: 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.10.40, 0.12.0, 0.12.2, 0.12.3, 0.12.6, 4.0.0, 4.1.0, 4.1.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3.0, 4.3.2, 4.4.0, 4.4.1, 4.4.6, 4.4.7, 4.5.0, 4.6.0, 4.6.1, 4.8.4, 5.0.0, 5.1.1, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.1, 6.0.0, 6.1.0, 6.2.2, 6.3.0, 6.5.0, 6.6.0, 6.7.0, 6.9.0, 6.9.1, 6.9.2, 6.9.4, 6.9.5, 6.10.0, 6.10.3, 6.11.1, 6.11.2, 6.11.5, 7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.7.0, 7.7.4, 7.10.0, 7.10.1, 8.0.0, 8.1.4, 8.4.0, 8.5.0, 8.7.0, 8.8.0, 8.8.1, 8.9.0.
Selected node.js version 8.9.0. Use package.json file to choose a different version.
Selected npm version 5.5.1
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml

> [email protected] postinstall D:\home\site\wwwroot\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm ERR! path D:\home\site\wwwroot\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall scandir
npm ERR! Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'
npm ERR!  { Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'
npm ERR!   stack: 'Error: EPERM: operation not permitted, scandir \'D:\\home\\site\\wwwroot\\node_modules\\fsevents\\node_modules\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'scandir',
npm ERR!   path: 'D:\\home\\site\\wwwroot\\node_modules\\fsevents\\node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\local\AppData\npm-cache\_logs\2017-11-22T04_28_58_782Z-debug.log
Failed exitCode=-4048, command="D:\Program Files (x86)\nodejs\8.9.0\node.exe" "D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\npm-cli.js" install --production
An error has occurred during web site deployment.
Missing server.js/app.js files, web.config is not generated\r\nnpm ERR! path D:\home\site\wwwroot\node_modules\fsevents\node_modules\r\nnpm ERR! code EPERM\r\nnpm ERR! errno -4048\r\nnpm ERR! syscall scandir\r\nnpm ERR! Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'\r\nnpm ERR!  { Error: EPERM: operation not permitted, scandir 'D:\home\site\wwwroot\node_modules\fsevents\node_modules'\r\nnpm ERR!   stack: 'Error: EPERM: operation not permitted, scandir \'D:\\home\\site\\wwwroot\\node_modules\\fsevents\\node_modules\'',\r\nnpm ERR!   errno: -4048,\r\nnpm ERR!   code: 'EPERM',\r\nnpm ERR!   syscall: 'scandir',\r\nnpm ERR!   path: 'D:\\home\\site\\wwwroot\\node_modules\\fsevents\\node_modules' }\r\nnpm ERR! \r\nnpm ERR! Please try running this command again as root/Administrator.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     D:\local\AppData\npm-cache\_logs\2017-11-22T04_28_58_782Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\67.61109.3117\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

After deleting node_modules the error is:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Start script "built/project1/server.js" from package.json is not found.
Missing server.js/app.js files, web.config is not generated
Looking for app.js/server.js under site root.
Node.js versions available on the platform are: 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.10.40, 0.12.0, 0.12.2, 0.12.3, 0.12.6, 4.0.0, 4.1.0, 4.1.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3.0, 4.3.2, 4.4.0, 4.4.1, 4.4.6, 4.4.7, 4.5.0, 4.6.0, 4.6.1, 4.8.4, 5.0.0, 5.1.1, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.1, 6.0.0, 6.1.0, 6.2.2, 6.3.0, 6.5.0, 6.6.0, 6.7.0, 6.9.0, 6.9.1, 6.9.2, 6.9.4, 6.9.5, 6.10.0, 6.10.3, 6.11.1, 6.11.2, 6.11.5, 7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.7.0, 7.7.4, 7.10.0, 7.10.1, 8.0.0, 8.1.4, 8.4.0, 8.5.0, 8.7.0, 8.8.0, 8.8.1, 8.9.0.
Selected node.js version 8.9.0. Use package.json file to choose a different version.
Selected npm version 5.5.1
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml
npm ERR! Cannot read property '0' of undefined
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\8.9.0\node.exe" "D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\npm-cli.js" install --production

1 Answer 1

1

I found someone reported similar in npm https://github.com/npm/npm/issues/17671 so I set an environment variable of NPM_CONFIG_OPTIONAL to true and it builds without the permission errors.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.