Whenever I try to run a locally installed version of testcafe, I get the error Cannot find module '../testcafe/lib/cli'. Steps I've taken:
git clone <testcafe>, then cd to testcafe
npm install
npm link
cd to repo where my automated tests reside
npm link testcafe
Run testcafe <browser>
Results in
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '/Users/rcooper/testcafe/lib/cli'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Is there something else I need to do, to run a local version of this library?
You need to build the TestCafe package. Run npx gulp build before the npm link command.
Related
I am reading the tutorial on Ethereum Pet Shop -- Your First DApp, everything seems ok until I test with truffle test with below error:
Error: Cannot find module 'fs-extra'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.call (/Users/.npm-global/lib/node_modules/truffle/node_modules/#truffle/debugger/dist/external "fs-extra":1:18)
at r (/Users/.npm-global/lib/node_modules/truffle/node_modules/#truffle/debugger/dist/webpack/bootstrap:19:22)
[...]
Truffle v5.2.4 (core: 5.2.4)
Node v10.16.0
I have tried some suggestions as in Module is extraneous npm, but the Error: Cannot find module 'fs-extra' insists.
You need to add it to your package.json and install the package.
Either run
npm install --save fs-extra
The --save option will add it to the package.json for you.
Or add it manually to the package.json section dependencies
"dependencies": {
"fs-extra": "^9.1.0"
}
and then install it
npm install
Version 9.1.0 is the current version according to npmjs
fs-extra-package should be delivered as part of truffle and I would not recommend installing it to the project.
To fix it on Ubuntu follow these steps:
# stop apps/tools that using truffle - ganache-cli, etc.
# uninstall truffle
sudo npm uninstall -g truffle
# install truffle again
sudo npm install -g truffle
# check that fs-extra packaged installed
ls -lh /usr/local/lib/node_modules/truffle/node_modules | grep fs-extra
I am trying to run android tests with the command node ./node_modules/.bin/wdio config/wdio.android.browser.conf.js and getting the following error:
me$ node ./node_modules/.bin/wdio config/wdio.android.browser.conf.js
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn appium ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
at Function.Module.runMain (module.js:696:11)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
I have the following versions in my package.json:
"wdio-appium-service": "^0.2.3",
"appium": "^1.12.1",
Please let me know what other info I can provide. Thank you.
I think I figured it out... in config/wdio.android.browser.conf.js I had services: [ 'appium' ], and trying to run just appium on my machine wasn't working. I installed appium globally with npm install -g appium and that made it work. I think I can point services to the appium in the local node_modules directory and maybe it would run it from there.
If you are using windows OS, appium section in your config file shall include command: 'appium.cmd' like this :
{
services: ['appium'],
appium: {
command: 'appium.cmd',
...
}
}
This error occurs due to 2 possible issues:
1) JAVAHOME variable is not correctly set for appium to start & run tests.
-> Check that JAVAHOME is correctly set and path points to the correct file.
2) There could have been some errors during Appium installation.
-> Try reinstalling appium using npm install -g appium command and ensure that appium is installed without any errors.
Obviously, run npm install to check and install any missing dependencies too.
I got a problem when I input any npm cmd, it says
internal/modules/cjs/loader.js:584
Operating System: Windows 10 64bit
What shall I do to solve this issue?
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'E:\FED\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
For many people on Mac (not sure about Windows/Linux), the solution is:
Delete node_modules and package-lock.json, then run $ npm install again.
You can also try updating your version of node.
Check version with $ node -v,
install with $ sudo n stable
I was having a similar error but it was because I hadn't had my node_modules(the ones you deleted ) file open in the file I was working on, even though I had run npm Install.
my Error was
Cannot find module _resolveFilename
If you build and deploy another place at a later time for example in an docker image, it may help to bundle the dependencies that the loader cannot find in package.json. Then the packaged are bundled and the loader can find them.
"bundledDependencies": [ "express", "express-http-proxy", ],
"dependencies": { ...}
Before starting any project you have to write this command npm init --yes
I was getting the following error when I ran "karma start"
module.js:340
throw err;
^
Error: Cannot find module 'jasmine-core'
at Function.Module._resolveFilename (module.js:338:15)
at Function.require.resolve (module.js:384:19)
at initJasmine (/usr/lib/node_modules/karma-jasmine/lib/index.js:8:42)
at Array.invoke [as 0] (/usr/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at get (/usr/lib/node_modules/karma/node_modules/di/lib/injector.js:48:43)
at /usr/lib/node_modules/karma/lib/server.js:137:20
at Array.forEach (native)
at Server._start (/usr/lib/node_modules/karma/lib/server.js:136:21)
at invoke (/usr/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at Server.start (/usr/lib/node_modules/karma/lib/server.js:101:18)
at Object.exports.run (/usr/lib/node_modules/karma/lib/cli.js:231:26)
at Object. (/usr/lib/node_modules/karma/bin/karma:3:23)
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)
Does anyone know why this is happening? I was running karma in a VM. I tried several npm install commands and nothing worked. After I shutdown my machine for the night and came back the next day the problem went away and everything is working again. So, I'm not blocked anymore.. Anyone have some thoughts on what could be happening?
I solved using npm install jasmine-core --save-dev
try install jasmine-core globally (Jasmine on NPM).
use npm install -g jasmine-core
Even with karma and karma-jasmine installed in the local project's node_modules you must still npm install jasmine.
So for a fresh Karma project:
npm install karma karma-jasmine jasmine to install the required modules locally.
Optionally add --save-dev to write to your package.json.
Note these do not need to be -g globally installed here.
karma start
This step requires you to have Karma installed globally (sudo npm install -g karma).
Navigate to folder:
cd node_modules\karma-jasmine
Run:
npm install
This should download the required dependencies and fix the issue.
Also, it is important to know the installation path where do you have karma.conf.js file.
I have this problem, and have tried every suggestion on the page without it fixing the problem. Well, I haven't yet rebooted, so I'll try that next, but I have closed my shell (git-bash) and re-opened it in case it was an environment variable problem. Something is wrong here and I don't think the problem has been identified yet.
Installed latest NPM v0.10.28
Then I installed express by
npm install express -g
Then I installed app as folows
express testExpress
cd testExpress && npm install
Then I ran following command to start server
DEBUG=testExpress ./bin/www
But it gives error
'DEBUG' is not recognized as an internal or external command,
operable program or batch file.
Also tried
node DEBUG=testExpress ./bin/www
Still gives error
module.js:340
throw err;
^
Error: Cannot find module 'C:\tmp\testExpress\DEBUG=testExpress'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
What mistake I am doing ? Please help.
You're trying to use Linux environment variable syntax on Windows.
You want
SET DEBUG=testExpress
bin\www