我使用windows os创建一个新的应用服务,将其连接到bitbucket并检查代码然后在npm install上失败。我觉得它应该工作,我不明白它是如何工作的。
我在底部放置了完整的错误跟踪。
首先我收到了这个错误:
无法找到模块'sync-exec'
好吧,好像它正在使用旧节点(我的package.json有"engines": { "node": "8.9.x" }
),我认为这是有效的,所以我尝试将环境变量WEBSITE_NODE_DEFAULT_VERSION
设置为8.9.0
但是这次仍然是错误的:
EPERM:不允许操作,scandir
我在一些帖子中读到尝试运行npm cache clean
它说它应该自动清理所以从控制台我尝试npm cache clean --force
然后我重建并仍然得到错误。出于解压,我尝试del /s /q node_modules
然后重建,现在得到更糟糕的错误。
无法读取未定义的属性“0”
也许删除这个文件夹很疯狂。如果我需要,我可以删除网络应用程序,然后重新开始。我创建了一个linux web应用程序,并且npm安装工作正常,但我还有其他linux问题,所以最好让windows工作。
以下是完整的日志输出:
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.
> microtime@2.1.6 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!
> node-sass@4.5.3 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
> uglifyjs-webpack-plugin@0.4.6 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! uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 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
设置版本环境变量后,错误为:
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
> uglifyjs-webpack-plugin@0.4.6 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"
删除node_modules后,错误为:
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
答案 0 :(得分:0)
我发现有人在npm https://github.com/npm/npm/issues/17671报告了类似情况
所以我将NPM_CONFIG_OPTIONAL
的环境变量设置为true
,并且在没有权限错误的情况下构建它。