npm start works on C: drive but not E: drive - node-modules

I have a repo for a project I am working on, when I clone the repo into my E: drive and try to do npm start, I get errors. However, when I clone the repo into my C: drive, it works flawlessly.
Here are the errors I am getting on my E: drive:
Failed to compile.
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\babel-loader\lib\index.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
asset static/js/bundle.js 48.5 KiB [emitted] (name: main) 1 related asset
asset index.html 9.19 KiB [emitted]
asset asset-manifest.json 190 bytes [emitted]
cached modules 27.1 KiB [cached] 9 modules
modules with errors 117 bytes [errors]
../../../../#work/Programming Projects/Blockwatch/Client/node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js 39 bytes [not cacheable] [built] [1 error]
../../../../#work/Programming Projects/Blockwatch/Client/node_modules/webpack/hot/dev-server.js 39 bytes [not cacheable] [built] [1 error]
../../../../#work/Programming Projects/Blockwatch/Client/src/index.js 39 bytes [not cacheable] [built] [1 error]
ERROR in ../../../../#work/Programming Projects/Blockwatch/Client/src/index.js
Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\babel-loader\lib\index.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:19:17)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:178:10)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:189:18
at handleResult (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:53:2)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:35:10)
ERROR in ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/webpack/hot/dev-server.js
Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\babel-loader\lib\index.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:19:17)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at runLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
at NormalModule._doBuild (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:814:3)
at NormalModule.build (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:958:15)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\Compilation.js:1369:12
ERROR in ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js
Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\babel-loader\lib\index.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:19:17)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at runLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
at NormalModule._doBuild (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:814:3)
at NormalModule.build (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:958:15)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\Compilation.js:1369:12
ERROR in Module not found: Error: Can't resolve 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-dev-server\client\index.js?protocol=ws%3A&hostname=0.0.0.0&port=3000&pathname=%2Fws&logging=none&reconnect=10' in 'E:\#work\Programming Projects\Blockwatch\Client'
ERROR in Error: Child compilation failed:
Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/html-webpack-plugin/lib/loader.js):
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\html-webpack-plugin\lib\loader.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:19:17)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at runLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
at NormalModule._doBuild (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:814:3)
at NormalModule.build (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:958:15)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\Compilation.js:1369:12
ModuleBuildError: Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/html-webpack-plugin/lib/loader.js):
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\html-webpack-plugin\lib\loader.js'
Require stack:
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:19:17)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at runLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
at NormalModule._doBuild (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:814:3)
at NormalModule.build (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:958:15)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\Compilation.js:1369:12
at processResult (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:753:19)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:855:5
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:399:11
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:185:11
at loadLoader (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js:33:11)
at iteratePitchingLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:182:2)
at runLoaders (E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js:397:2)
at NormalModule._doBuild (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:814:3)
at NormalModule.build (E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js:958:15)
at E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\Compilation.js:1369:12
- loader:933 Function.Module._resolveFilename
node:internal/modules/cjs/loader:933:15
- loader:778 Function.Module._load
node:internal/modules/cjs/loader:778:27
- loader:1005 Module.require
node:internal/modules/cjs/loader:1005:19
- helpers:102 require
node:internal/modules/cjs/helpers:102:18
- loadLoader.js:19 loadLoader
[Client]/[loader-runner]/lib/loadLoader.js:19:17
- LoaderRunner.js:182 iteratePitchingLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:182:2
- LoaderRunner.js:397 runLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:397:2
- NormalModule.js:814 NormalModule._doBuild
[Client]/[webpack]/lib/NormalModule.js:814:3
- NormalModule.js:958 NormalModule.build
[Client]/[webpack]/lib/NormalModule.js:958:15
- Compilation.js:1369
[Client]/[webpack]/lib/Compilation.js:1369:12
- ModuleBuildError: Module build failed (from ../../../../#work/Programming Projects/Blockwatch/Client/node_modules/html-webpack-plugin/lib/loader.js):
- Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\html-webpack-plugin\lib\loader.js'
- Require stack:
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\loadLoader.js
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\loader-runner\lib\LoaderRunner.js
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack\lib\NormalModule.js
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\webpack-manifest-plugin\dist\index.js
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\config\webpack.config.js
- - E:\#work\Programming Projects\Blockwatch\Client\node_modules\react-scripts\scripts\start.js
- loader:933 Function.Module._resolveFilename
node:internal/modules/cjs/loader:933:15
- loader:778 Function.Module._load
node:internal/modules/cjs/loader:778:27
- loader:1005 Module.require
node:internal/modules/cjs/loader:1005:19
- helpers:102 require
node:internal/modules/cjs/helpers:102:18
- loadLoader.js:19 loadLoader
[Client]/[loader-runner]/lib/loadLoader.js:19:17
- LoaderRunner.js:182 iteratePitchingLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:182:2
- LoaderRunner.js:397 runLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:397:2
- NormalModule.js:814 NormalModule._doBuild
[Client]/[webpack]/lib/NormalModule.js:814:3
- NormalModule.js:958 NormalModule.build
[Client]/[webpack]/lib/NormalModule.js:958:15
- Compilation.js:1369
[Client]/[webpack]/lib/Compilation.js:1369:12
- NormalModule.js:753 processResult
[Client]/[webpack]/lib/NormalModule.js:753:19
- NormalModule.js:855
[Client]/[webpack]/lib/NormalModule.js:855:5
- LoaderRunner.js:399
[Client]/[loader-runner]/lib/LoaderRunner.js:399:11
- LoaderRunner.js:185
[Client]/[loader-runner]/lib/LoaderRunner.js:185:11
- loadLoader.js:33 loadLoader
[Client]/[loader-runner]/lib/loadLoader.js:33:11
- LoaderRunner.js:182 iteratePitchingLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:182:2
- LoaderRunner.js:397 runLoaders
[Client]/[loader-runner]/lib/LoaderRunner.js:397:2
- NormalModule.js:814 NormalModule._doBuild
[Client]/[webpack]/lib/NormalModule.js:814:3
- NormalModule.js:958 NormalModule.build
[Client]/[webpack]/lib/NormalModule.js:958:15
- Compilation.js:1369
[Client]/[webpack]/lib/Compilation.js:1369:12
- child-compiler.js:169
[Client]/[html-webpack-plugin]/lib/child-compiler.js:169:18
- Compiler.js:564
[Client]/[webpack]/lib/Compiler.js:564:11
- Compiler.js:1183
[Client]/[webpack]/lib/Compiler.js:1183:17
- Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
[Client]/[tapable]/lib/Hook.js:18:14
- Compiler.js:1179
[Client]/[webpack]/lib/Compiler.js:1179:33
- Compilation.js:2784 finalCallback
[Client]/[webpack]/lib/Compilation.js:2784:11
- Compilation.js:3089
[Client]/[webpack]/lib/Compilation.js:3089:11
- Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
[Client]/[tapable]/lib/Hook.js:18:14
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
1 error has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.67.0 compiled with 6 errors in 1350 ms
When it says
Error: Cannot find module 'E:\#work\Programming Projects\Blockwatch\Client\node_modules\babel-loader\lib\index.js'
I go to check if the path exists and it does, so I'm not sure why it fails to find it.
I have tried deleting the node_modules folder and running npm install
on it but I have had no success.

delete node_modules and try this, it will install packages globally:
npm install -g

Related

Ruby (Chef) Hash Array - Name is a Required Property

I'm trying to create a recipe to deploy Remote Desktop Services to Windows Servers, everything is working as expected apart from the Application deployment resource I created - it's a simple resource but I'm having a lot of issues passing the applications to be deployed as a hash array.
attributes\default.rb
default['app']['app_options'] = [
{
connection_broker: 'serv-01',
options: {
collectionname: 'Terminal Services',
alias: 'Acrobat',
displayname: 'Adobe Acrobat',
filepath: 'C:\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe',
filevirtualpath: 'C:\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe',
commandlinesetting: 'DoNotAllow',
iconindex: '0',
iconpath: '\\\\serv-01\\C$\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe',
usergroups: ['domain\\group'],
showinwebaccess: '1'
}
},
{
connection_broker: 'serv-01',
options: {
collectionname: 'Terminal Services',
alias: 'Accounts',
displayname: 'Accounts',
foldername: 'Accounts',
filepath: 'D:\\Accounts\\Accounts.bat',
filevirtualpath: 'D:\\Accounts\\Accounts.bat',
commandlinesetting: 'DoNotAllow',
iconindex: '0',
iconpath: 'C:\\Windows\\System32\\cmd.exe',
usergroups: ['domain\\group'],
showinwebaccess: '1'
}
}
]
recipes\remote_desktop.rb
rdapps = node.read('app', 'app_options') || []
rdapps.each do |app|
remote_desktop_apps app['options']['alias'] do
action :create
connection_broker app['connection_broker']
app_options app['options']
end
end
resources\remote_desktop_apps.rb
resource_name :remote_desktop_apps
property :connection_broker, String,
desired_state: false
property :app_options, [String, Hash, Array],
desired_state: false
action :create do
app_options.each do |k,v|
script << "New-RDRemoteApp -ConnectionBroker "#{connection_broker}" {-#{k.to_s.capitalize} #{v}}.join(' ')}"
end
end
Edit
Thanks to #seshadri_c for the help past the first hurdle, I've hit another issue which seems related to the attributes.
Here is the output of a kitchen converge
================================================================================
Error executing action `create` on resource 'remote_desktop_apps[Acrobat]'
================================================================================
Chef::Exceptions::ValidationFailed
----------------------------------
name is a required property
Resource Declaration:
---------------------
# In C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/windows_/recipes/remote_desktop.rb
76: remote_desktop_apps app['options']['alias'] do
77: action :create
78: connection_broker app['connection_broker']
79: app_options app['options']
80: end
81: end
Compiled Resource:
------------------
# Declared in C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/windows_/recipes/remote_desktop.rb:76:in `block in from_file'
remote_desktop_apps("Acrobat") do
action [:create]
default_guard_interpreter :default
declared_type :remote_desktop_apps
cookbook_name "windows_"
recipe_name "remote_desktop"
connection_broker "serv-01"
app_options {"collectionname"=>"Terminal Services", "alias"=>"Acrobat", "displayname"=>"Adobe Acrobat", "filepath"=>"C:\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe", "filevirtualpath"=>"C:\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe", "commandlinesetting"=>"DoNotAllow", "iconindex"=>"0", "iconpath"=>"\\\\serv-01\\C$\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Acrobat.exe", "usergroups"=>["domain\\group"], "showinwebaccess"=>"1"}
end
Then there's this message at the end of the run:
FATAL: Chef::Exceptions::ValidationFailed: remote_desktop_apps[Acrobat] (windows_::remote_desktop line 76) had an error: Chef::Exceptions::ValidationFailed: name is a required property
$$$$$$ Exception calling "Read" with "3" argument(s): "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."
At line:100 char:11
$$$$$$ + if ($fs.Read($bytes, 0, $fs.Length) -gt 0) {
$$$$$$ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException

AWS Lambda Ruby 2.7 and Selenium can't connect to Chrome

I intend to create an AWS lambda function using Ruby 2.7 with Selenium. When I try to run my example function i get:
{
"errorMessage": "unable to connect to /opt/chromedriver 127.0.0.1:9515",
"errorType": "Function<Selenium::WebDriver::Error::WebDriverError>",
"stackTrace": [
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/service_manager.rb:138:in `connect_until_stable'",
Which is confusing to me because the file is located in that path. I have created a AWS layer with both chromedriver and chromium headless. After creating the layers i have attached them to the function. The error when the files are not there is different so I am assuming it can reach the files.
My sample program is:
require 'json'
require 'selenium-webdriver'
def lambda_handler(event:, context:)
driver = setup_driver
driver.navigate.to 'http://www.google.com'
element = driver.find_element(name: 'q')
element.send_keys 'Pizza'
element.submit
title = driver.title
driver.quit
{ statusCode: 200, body: JSON.generate(title) }
end
def setup_driver
service = Selenium::WebDriver::Service.chrome(path: '/opt/chromedriver')
Selenium::WebDriver.for :chrome, service: service, options: driver_options
end
def driver_options
options = Selenium::WebDriver::Chrome::Options.new(binary: '/opt/headless-chromium')
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_argument("--window-size=#{800},#{600}")
options.add_argument('--disable-popup-blocking')
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--single-process')
return options
end
Update:
After locating the proper chromedriver and installing google chrome from the yum repo i managed to get it to work locally.
Here is my Dockerfile
FROM public.ecr.aws/lambda/ruby:2.7
COPY . ${LAMBDA_TASK_ROOT}
RUN bundle config --local silence_root_warning true
RUN bundle install --path vendor/bundle --clean
# USER root
RUN yum -y install wget unzip
# Chromium
COPY google-chrome.repo /etc/yum.repos.d/google-chrome.repo
RUN yum install google-chrome-stable -y
# Chromedriver
RUN wget https://chromedriver.storage.googleapis.com/102.0.5005.61/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip -d /usr/bin/
RUN rm chromedriver_linux64.zip
CMD [ "lambda_function.lambda_handler" ]
When i run it locally with:
docker run -p 9000:8080 prueba
And test it in a different terminal:
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}'
{"statusCode":200,"body":"\"Pizza - Buscar con Google\""}%
It works wonderful!!!
However when deploying it (By publishing the docker image in the ECR and creating a lambda using given docker image) i get the following error:
{
"errorMessage": "Net::ReadTimeout with #<TCPSocket:(closed)>",
"errorType": "Function<Net::ReadTimeout>",
"stackTrace": [
"/var/lang/lib/ruby/2.7.0/net/protocol.rb:217:in `rbuf_fill'",
"/var/lang/lib/ruby/2.7.0/net/protocol.rb:191:in `readuntil'",
"/var/lang/lib/ruby/2.7.0/net/protocol.rb:201:in `readline'",
"/var/lang/lib/ruby/2.7.0/net/http/response.rb:42:in `read_status_line'",
"/var/lang/lib/ruby/2.7.0/net/http/response.rb:31:in `read_new'",
"/var/lang/lib/ruby/2.7.0/net/http.rb:1528:in `block in transport_request'",
"/var/lang/lib/ruby/2.7.0/net/http.rb:1519:in `catch'",
"/var/lang/lib/ruby/2.7.0/net/http.rb:1519:in `transport_request'",
"/var/lang/lib/ruby/2.7.0/net/http.rb:1492:in `request'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/remote/http/default.rb:118:in `response_for'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/remote/http/default.rb:77:in `request'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/remote/bridge.rb:592:in `execute'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/remote/bridge.rb:52:in `create_session'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:314:in `block in create_bridge'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:312:in `tap'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:312:in `create_bridge'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:74:in `initialize'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:47:in `new'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver/common/driver.rb:47:in `for'",
"/var/task/vendor/bundle/ruby/2.7.0/gems/selenium-webdriver-4.3.0/lib/selenium/webdriver.rb:89:in `for'",
"/var/task/lambda_function.rb:19:in `setup_driver'",
"/var/task/lambda_function.rb:7:in `lambda_handler'"
]
}
I have already added memory and timeout seconds to the lambda function but it still fails. This is odd because it works locally but not on the actual AWS Lambda.

chef template gives No such file or directory # rb_sysopen Errno::ENOENT

I have chef recipe with this block :
if ( platform === 'suse' )
repo_name="some_repo"
template '/etc/zypp/repos.d/some_repo' do
source 'some_repo.rpm.repo.erb'
variables( :os => "#{os}", :distro => "#{distro}", :repo_name => "#{repo_name}" )
owner "root"
group "root"
mode '644'
end
end
I understand the template should by default create the file.
But it doesn't create the file and it gives the error No such file or directory.
The template some_repo.rpm.repo.erb itself looks like this:
[<%= #repo_name %>]
name=<%= #repo_name %>
baseurl=http://BLA.com//repos/<%= #os %>/<%= #distro %>
enabled=1
gpgcheck=0
sslverify=0
proxy=_none_
What am I doing wrong ?
EDIT :full error logs
Recipe Compile Error in /tmp/ldt_chef_run/local-mode-cache/cache/cookbooks/recipes/default.rb
================================================================================
Errno::ENOENT
-------------
No such file or directory # rb_sysopen - /etc/zypp/repos.d/some_repo
Cookbook Trace:
---------------
/tmp/ldt_chef_run/local-mode-cache/cache/cookbooks/recipes/default.rb:106:in `read'
/tmp/ldt_chef_run/local-mode-cache/cache/cookbooks/recipes/default.rb:106:in `block in from_file'
/tmp/ldt_chef_run/local-mode-cache/cache/cookbooks/recipes/default.rb:104:in `from_file'
Relevant File Content:
----------------------
/tmp/ldt_chef_run/local-mode-cache/cache/cookbooks/zabbix_agent/recipes/default.rb:
99: owner 'root'
100: group 'root'
101: mode '0755'
102: action :create
103: end
104: file '/tmp/some.repos.d/some.repo' do
105: mode '0644'
106>> content IO.read(node['somepackage'][node['platform']]['repo_source'])
107: action :create
108: end
109: end
110:
111: ######### Install package ###########
112: #package 'somepackage' do
113: # action :install
114: #end
115: node['somepackage'][node['platform']]['packages'].each do |pkg|
System Info:
------------
chef_version=14.2.0
platform=redhat
platform_version=7.5
ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
program_name=/bin/chef-solo
executable=/opt/chef/bin/chef-solo
Running handlers:
[2019-02-10T11:32:27+02:00] ERROR: Running exception handlers
[2019-02-10T11:32:27+02:00] ERROR: Running exception handlers
Running handlers complete
[2019-02-10T11:32:27+02:00] ERROR: Exception handlers complete
[2019-02-10T11:32:27+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 11 seconds
[2019-02-10T11:32:27+02:00] FATAL: Stacktrace dumped to /tmp/ldt_chef_run/local-mode-cache/cache/chef-stacktrace.out
[2019-02-10T11:32:27+02:00] FATAL: Stacktrace dumped to /tmp/ldt_chef_run/local-mode-cache/cache/chef-stacktrace.out
[2019-02-10T11:32:27+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-02-10T11:32:27+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-02-10T11:32:27+02:00] FATAL: Errno::ENOENT: No such file or directory # rb_sysopen - /etc/zypp/repos.d/some_repo
[2019-02-10T11:32:27+02:00] FATAL: Errno::ENOENT: No such file or directory # rb_sysopen - /etc/zypp/repos.d/some_repo
EDIT2 :
I know the issue is related to a block coming after the
template i have this :
if %w(redhat suse sles).include?(node['platform'])
directory '/tmp/some.repos.d' do
owner 'root'
group 'root'
mode '0755'
action :create
end
file '/tmp/some.repos.d/some.repo' do
mode '0644'
content IO.read(node['somepakage'][node['platform']]['repo_source'])
action :create
end
end
I wanted to copy the content of the file that the template created:
"/etc/zypp/repos.d/some_repo"
to /tmp/some.repos.d/some.repo
it seems like this block is creating the error with the template block
which make the template not creating the new file, as a resulted the
content IO.read block gets an error as the file was not created at the template stage.
this error only happed if i delete the file :
/etc/zypp/repos.d/some_repo
for testing to see if cookbook will re-create it.
if this file exists no errors.
So, why "content IO.read" cancels "template" ?
This is the workaround :
Addings this line to the start of all blockes :
if %w(redhat suse sles ubuntu debian).include?(node['platform'])
directory '/tmp/some.repos.d' do
owner 'root'
group 'root'
mode '0755'
action :create
end
end
Then just duplicate the "template" block , for the other file :
if ( platform === 'suse' )
repo_name="some_repo"
template '/etc/zypp/repos.d/some.repo' do
source 'some.rpm.repo.erb'
variables( :os => "#{os}", :distro => "#{distro}", :repo_name => "#{repo_name}" )
owner "root"
group "root"
mode '644'
end
template '/tmp/some.repos.d/some.repo' do
source 'some.rpm.repo.erb'
variables( :os => "#{os}", :distro => "#{distro}", :repo_name => "#{repo_name}" )
owner "root"
group "root"
mode '644'
end
end

Save File popup issue

Issue
I have tried all possibilities by setting profile variables, however the Save dialog in firefox is still appearing every time I try to download a file using my automation framework
Content Type of file which is am trying to download is application/csv (for 1 file, rest are mentioned in below code snipit)
Setup -
Firefox Version -
52.8.0 (64 Bit)
Gemfile
source 'https://rubygems.org'
gem 'actionpack', '~> 4.2.4', require: false
gem 'activemodel', '~> 4.2.4'
gem 'Ascii85'
gem 'browserstack-local'
gem 'cucumber', '< 2.0.0'
gem 'cukeforker'
gem 'cukeforker-webdriver'
gem 'headless'
gem 'httparty'
gem 'json'
gem 'mysql2'
gem 'nokogiri'
gem 'pdf-reader'
gem 'pry'
gem 'rubocop', '~> 0.52.1', require: false
gem 'selenium-webdriver', '3.6.0' # Best practice: keep in sync with hub version
gem 'site_prism'
gem 'uuid'
env.rb
Before do
firefox_profile = Selenium::WebDriver::Firefox::Profile.new
firefox_profile['browser.download.dir'] = ENV['ENV_TEMP_PATH']
firefox_profile['browser.download.folderList'] = 2
firefox_profile['browser.download.panel.shown'] = false
firefox_profile['browser.helperApps.alwaysAsk.force'] = false
firefox_profile['browser.download.manager.showWhenStarting'] = false
firefox_profile['browser.helperApps.neverAsk.openFile'] = 'application/csv, application/octet-stream, text/csv, application/zip, application/pdf, application/xml, application/x-x509-ca-cert'
firefox_profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/csv, application/octet-stream, text/csv, application/zip, application/pdf, application/xml, application/x-x509-ca-cert'
firefox_profile['timeout'] = 480000
firefox_profile['pdfjs.disabled'] = true
firefox_profile['resynchronization_timeout'] = 90
firefox_profile['resynchronize '] = true
firefox_profile['dom.max_chrome_script_run_time'] = 0
firefox_profile['dom.max_script_run_time'] = 0
Capybara.default_selector = :css
Capybara.ignore_hidden_elements = true
Capybara.run_server = false
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 240
Capybara.default_driver = :firefox
Capybara.register_driver :firefox do |app|
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: firefox_profile, marionette: false, http_client: client)
end
end
Please note -
I have tried following as well
firefox_profile['browser.helperApps.neverAsk.openFile'] = 'application/csv; application/octet-stream; text/csv; application/zip; application/pdf; application/xml; application/x-x509-ca-cert'
firefox_profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/csv; application/octet-stream; text/csv; application/zip; application/pdf; application/xml; application/x-x509-ca-cert'
Looking for help from experts in our automation active community
Why are you setting both 'browser.helperApps.neverAsk.openFile' and ''browser.helperApps.neverAsk.saveToDisk' to the same mime types? Those are conflicting settings since one is saying to open those file types in the browser and the other is saying to save them to disk (open in browser takes precedence). Also - Firefox 52 was released 2 years ago, may be time to upgrade.
Downloading of files is tested in Capybaras own test suite so you can see the minimal settings required there (obviously adjust mime types as needed) - https://github.com/teamcapybara/capybara/blob/master/spec/selenium_spec_marionette.rb#L13

Keep Getting "Could not find passenger (>=0) amongst" While Passenger

I've been debugging this more than one day, and no luck,
After I install ruby, gems, and Passenger, I tried to start Passenger, but I keep getting "Could not find passenger":
passenger#dragon:/usr/website/myapp/current$ passenger start -p 4000 -e production -d
/home/passenger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find passenger (>= 0) amongst [actionmailer-3.2.8, actionmailer-3.2.3, actionpack-3.2.8, actionpack-3.2.3, activemodel-3.2.8, activemodel-3.2.3, activerecord-3.2.8, activerecord-3.2.3, activeresource-3.2.8, activeresource-3.2.3, activesupport-3.2.8, activesupport-3.2.3, arel-3.0.2, bcrypt-ruby-3.0.1, builder-3.0.3, builder-3.0.0, cape-1.4.0, capistrano-2.13.4, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.3.3, devise-2.1.2, devise_ldap_authenticatable-0.6.1, erubis-2.7.0, execjs-1.4.0, guess_html_encoding-0.0.4, high_voltage-1.1.1, highline-1.6.15, hike-1.2.1, i18n-0.6.1, i18n-0.6.0, journey-1.0.4, jquery-rails-2.0.2, jruby-pageant-1.1.1, jsmin-1.0.1, json-1.7.3, libv8-3.3.10.4-x86-linux, mail-2.4.4, mime-types-1.19, mini_magick-3.4, multi_json-1.3.6, net-ldap-0.2.2, net-scp-1.0.4, net-sftp-2.0.5, net-ssh-2.6.0, net-ssh-gateway-1.1.0, nokogiri-1.5.5, orm_adapter-0.4.0, polyglot-0.3.3, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.2.8, rails-3.2.3, rails-settings-cached-0.2.1, railties-3.2.8, railties-3.2.3, rake-0.9.2.2, rdoc-3.12, ruby-readability-0.5.4, rvm-capistrano-1.2.7, sass-3.1.20, sass-rails-3.2.5, sprockets-2.1.3, sqlite3-1.3.6, subexec-0.2.2, swfobject-rails-1.1.1, therubyracer-0.10.1, thor-0.16.0, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.33, uglifier-1.2.5, warden-1.2.1] (Gem::LoadError)
from /home/passenger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/passenger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /home/passenger/.rvm/gems/ruby-1.9.3-p194/bin/passenger:18:in `<main>'
from /home/passenger/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
from /home/passenger/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
While Passenger gem is installed (I used gem install passenger to install it) as you can see:
passenger#dragon:/usr/website/myapp/current$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.0)
bundler (1.2.1)
cape (1.4.0)
capistrano (2.13.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
daemon_controller (1.0.0)
devise (2.1.2)
devise_ldap_authenticatable (0.6.1)
erubis (2.7.0)
execjs (1.4.0)
fastthread (1.0.7)
file-tail (1.0.11)
guess_html_encoding (0.0.4)
high_voltage (1.1.1)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
jruby-pageant (1.1.1)
jsmin (1.0.1)
json (1.7.3)
libv8 (3.3.10.4 x86-linux)
mail (2.4.4)
mime-types (1.19)
mini_magick (3.4)
multi_json (1.3.6)
net-ldap (0.2.2)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.0)
net-ssh-gateway (1.1.0)
nokogiri (1.5.5)
orm_adapter (0.4.0)
passenger (3.0.17)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
rails-settings-cached (0.2.1)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
ruby-readability (0.5.4)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
rvm-capistrano (1.2.7)
sass (3.1.20)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
subexec (0.2.2)
swfobject-rails (1.1.1)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
tins (0.5.5)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.5)
warden (1.2.1)
and here is my gem environment:
passenger#dragon:/usr/website/myapp/current$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
- INSTALLATION DIRECTORY: /home/passenger/.rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /home/passenger/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/passenger/.rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/passenger/.rvm/gems/ruby-1.9.3-p194
- /home/passenger/.rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
and here is the rvm info:
passenger#dragon:/usr/website/myapp/current$ rvm info
ruby-1.9.3-p194:
system:
uname: "Linux dragon 3.2.0-26-generic-pae #41-Ubuntu SMP Thu Jun 14 16:45:14 UTC 2012 i686 i686 i386 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.15.9 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "2 days 23 hours 20 minutes 14 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "i686-linux"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]"
homes:
gem: "/home/passenger/.rvm/gems/ruby-1.9.3-p194"
ruby: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/home/passenger/.rvm/gems/ruby-1.9.3-p194#global/bin/rake"
environment:
PATH: "/home/passenger/.rvm/gems/ruby-1.9.3-p194/bin:/home/passenger/.rvm/gems/ruby-1.9.3-p194#global/bin:/home/passenger/.rvm/rubies/ruby-1.9.3-p194/bin:/home/passenger/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME: "/home/passenger/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/home/passenger/.rvm/gems/ruby-1.9.3-p194:/home/passenger/.rvm/gems/ruby-1.9.3-p194#global"
MY_RUBY_HOME: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/home/passenger/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
And here is the method (Line 247) that throws the error:
1 require "rubygems/requirement"
2
3 ##
4 # The Dependency class holds a Gem name and a Gem::Requirement.
5
6 class Gem::Dependency
7
8 ##
9 # Valid dependency types.
10 #--
11 # When this list is updated, be sure to change
12 # Gem::Specification::CURRENT_SPECIFICATION_VERSION as well.
13
14 TYPES = [
15 :development,
16 :runtime,
17 ]
18
19 ##
20 # Dependency name or regular expression.
21
22 attr_accessor :name
23
24 ##
25 # Allows you to force this dependency to be a prerelease.
26
27 attr_writer :prerelease
28
29 ##
30 # Constructs a dependency with +name+ and +requirements+. The last
31 # argument can optionally be the dependency type, which defaults to
32 # <tt>:runtime</tt>.
33
34 def initialize name, *requirements
35 if Regexp === name then
36 msg = ["NOTE: Dependency.new w/ a regexp is deprecated.",
37 "Dependency.new called from #{Gem.location_of_caller.join(":")}"]
38 warn msg.join("\n") unless Gem::Deprecate.skip
39 end
40
41 type = Symbol === requirements.last ? requirements.pop : :runtime
42 requirements = requirements.first if 1 == requirements.length # unpack
43
44 unless TYPES.include? type
45 raise ArgumentError, "Valid types are #{TYPES.inspect}, "
46 + "not #{type.inspect}"
47 end
48
49 #name = name
50 #requirement = Gem::Requirement.create requirements
51 #type = type
52 #prerelease = false
53
54 # This is for Marshal backwards compatibility. See the comments in
55 # +requirement+ for the dirty details.
56
57 #version_requirements = #requirement
58 end
59
60 ##
61 # A dependency's hash is the XOR of the hashes of +name+, +type+,
62 # and +requirement+.
63
64 def hash # :nodoc:
65 name.hash ^ type.hash ^ requirement.hash
66 end
67
68 def inspect # :nodoc:
69 "<%s type=%p name=%p requirements=%p>" %
70 [self.class, self.type, self.name, requirement.to_s]
71 end
72
73 ##
74 # Does this dependency require a prerelease?
75
76 def prerelease?
77 #prerelease || requirement.prerelease?
78 end
79
80 def pretty_print q # :nodoc:
81 q.group 1, 'Gem::Dependency.new(', ')' do
82 q.pp name
83 q.text ','
84 q.breakable
85
86 q.pp requirement
87
88 q.text ','
89 q.breakable
90
91 q.pp type
92 end
93 end
94
95 ##
96 # What does this dependency require?
97
98 def requirement
99 return #requirement if defined?(#requirement) and #requirement
100
101 # #version_requirements and #version_requirement are legacy ivar
102 # names, and supported here because older gems need to keep
103 # working and Dependency doesn't implement marshal_dump and
104 # marshal_load. In a happier world, this would be an
105 # attr_accessor. The horrifying instance_variable_get you see
106 # below is also the legacy of some old restructurings.
107 #
108 # Note also that because of backwards compatibility (loading new
109 # gems in an old RubyGems installation), we can't add explicit
110 # marshaling to this class until we want to make a big
111 # break. Maybe 2.0.
112 #
113 # Children, define explicit marshal and unmarshal behavior for
114 # public classes. Marshal formats are part of your public API.
115
116 if defined?(#version_requirement) && #version_requirement
117 version = #version_requirement.instance_variable_get :#version
118 #version_requirement = nil
119 #version_requirements = Gem::Requirement.new version
120 end
121
122 #requirement = #version_requirements if defined?(#version_requirements)
123 end
124
125 def requirements_list
126 requirement.as_list
127 end
128
129 def to_s # :nodoc:
130 if type != :runtime then
131 "#{name} (#{requirement}, #{type})"
132 else
133 "#{name} (#{requirement})"
134 end
135 end
136
137 ##
138 # Dependency type.
139
140 def type
141 #type ||= :runtime
142 end
143
144 def == other # :nodoc:
145 Gem::Dependency === other &&
146 self.name == other.name &&
147 self.type == other.type &&
148 self.requirement == other.requirement
149 end
150
151 ##
152 # Dependencies are ordered by name.
153
154 def <=> other
155 self.name <=> other.name
156 end
157
158 ##
159 # Uses this dependency as a pattern to compare to +other+. This
160 # dependency will match if the name matches the other's name, and
161 # other has only an equal version requirement that satisfies this
162 # dependency.
163
164 def =~ other
165 unless Gem::Dependency === other
166 return unless other.respond_to?(:name) && other.respond_to?(:version)
167 other = Gem::Dependency.new other.name, other.version
168 end
169
170 return false unless name === other.name
171
172 reqs = other.requirement.requirements
173
174 return false unless reqs.length == 1
175 return false unless reqs.first.first == '='
176
177 version = reqs.first.last
178
179 requirement.satisfied_by? version
180 end
181
182 def match? name, version
183 return false unless self.name === name
184 return true if requirement.none?
185
186 requirement.satisfied_by? Gem::Version.new(version)
187 end
188
189 def matches_spec? spec
190 return false unless name === spec.name
191 return true if requirement.none?
192
193 requirement.satisfied_by?(spec.version)
194 end
195
196 ##
197 # Merges the requirements of +other+ into this dependency
198
199 def merge other
200 unless name == other.name then
201 raise ArgumentError,
202 "#{self} and #{other} have different names"
203 end
204
205 default = Gem::Requirement.default
206 self_req = self.requirement
207 other_req = other.requirement
208
209 return self.class.new name, self_req if other_req == default
210 return self.class.new name, other_req if self_req == default
211
212 self.class.new name, self_req.as_list.concat(other_req.as_list)
213 end
214
215 def matching_specs platform_only = false
216 matches = Gem::Specification.find_all { |spec|
217 self.name === spec.name and # TODO: == instead of ===
218 requirement.satisfied_by? spec.version
219 }
220
221 if platform_only
222 matches.reject! { |spec|
223 not Gem::Platform.match spec.platform
224 }
225 end
226
227 matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
228 end
229
230 ##
231 # True if the dependency will not always match the latest version.
232
233 def specific?
234 #requirement.specific?
235 end
236
237 def to_specs
238 matches = matching_specs true
239
240 # TODO: check Gem.activated_spec[self.name] in case matches falls outside
241
242 if matches.empty? then
243 specs = Gem::Specification.all_names.join ", "
244 error = Gem::LoadError.new "Could not find #{name} (#{requirement}) amongst [#{specs}]"
245 error.name = self.name
246 error.requirement = self.requirement
247 raise error
248 end
249
250 # TODO: any other resolver validations should go here
251
252 matches
253 end
254
255 def to_spec
256 matches = self.to_specs
257
258 matches.find { |spec| spec.activated? } or matches.last
259 end
260 end
Did you make sure that passenger is in your Gemfile? I see you installed bundler and I think that is related to the ruby_noexec_wrapper in your stack trace.

Resources