I'm trying to use Loopback to create an api for my existing database. When I try to 'discover' the model, I get this error:
Message: Cannot find module 'negotiator'
Request: /workspace/api/DataSourceDefinitions/server.tweetvtds/testConnection
Staus: 500
Error: Cannot find module 'negotiator'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (~/lb/node_modules/loopback/node_modules/express/node_modules/accepts/index.js:1:80)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
I read elsewhere that I should try:
# uninstall the existing version
npm uninstall -g generator-loopback
# install it again
npm install -g generator-loopback
But that didn't help. What does this error mean and how do I fix it?
It turns out that the initial build of the project didn't fully complete.
During the initial build, Loopback printed the following:
I'm all done. Running npm install for you to install the required
dependencies. If this fails, try running the command yourself.
create .editorconfig
create .jshintignore
create .jshintrc
create README.md
create server/boot/authentication.js
create server/boot/explorer.js
create server/boot/rest-api.js
create server/boot/root.js
create server/middleware.json
create server/server.js
create .gitignore
create client/README.md
It failed to complete this step; however, running 'npm install' myself didn't fix the problem for some reason. So, I just built a new loopback project and everything is working fine now.
Related
when i try to use const Canvas = require("canvacord") it gives this error
Error: libuuid.so.1: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/runner/bot/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
Hint: hit control+c anytime to enter REPL.
is there a way to fix this?
Due to a lack of context and instructions I was unable to reproduce your issue. Although, assuming that you are using Repl.it, there is a comment about a similar issue available on Github:
If you are facing this error at replit
Follow this steps to fix it:
Click on three dots and then click on show hidden files
Go to file name 'replit.nix'
now under deps add: pkgs.libuuid
now after deps go to a fresh line (make sure there are no syntax conflicts), and paste this:
env = { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid]; };
Tada 🎉 your error is fixed, enjoy and thank me later :)
If this doesn't work, make sure you installed libuuid which is a dependency of node-canvas which itself is a dependency fo canvacord. Should be already installed on most Linux machines but maybe it's not... Run: apt-get install libuuid1
ajayror#Ajays-MacBook-Air phgh % yarn start
yarn run v1.22.11
warning ../../package.json: No license field
$ react-scripts start
node:internal/modules/cjs/loader:488
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /Users/ajayror/Desktop/phgh/node_modules/postcss-safe-parser/node_modules/postcss/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)
at packageExportsResolve (node:internal/modules/esm/resolve:669:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/ajayror/Desktop/phgh/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v17.0.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It seems like we all are facing the same issue, it's taken me so long to solve this problem. Simply follow this, uninstall the current version of node (v17.0.1) and install LTS(v16.13.1). I hope it will work no matter what.
Thanks for your douth.
I am trying to integrate Selenium IDE with Azure devops test plan
I have an "NPM install" task in my release pipeline and received an error of Error: Npm failed with return code: 1
This is the error from the log:
2020-10-12T22:37:37.9680875Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" test"
2020-10-12T22:38:16.6366869Z
2020-10-12T22:38:16.6367643Z > ind#1.0.0 test D:\a\r1\a\Test_IND-CI \drop\Selenium IDE
2020-10-12T22:38:16.6368107Z > npx mocha --reporter xunit > result.xml
2020-10-12T22:38:16.6368363Z
2020-10-12T22:38:16.6368738Z npx: installed 136 in 32.857s
2020-10-12T22:38:16.6368973Z
2020-10-12T22:38:16.6369245Z Error: Cannot find module 'selenium-webdriver'
2020-10-12T22:38:16.6369465Z Require stack:
2020-10-12T22:38:16.6369714Z - D:\a\r1\a\Test_IND-CI \drop\Selenium IDE\test.js
2020-10-12T22:38:16.6370004Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js
2020-10-12T22:38:16.6370300Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\mocha.js
2020-10-12T22:38:16.6370850Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\one-and-dones.js
2020-10-12T22:38:16.6371232Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\options.js
2020-10-12T22:38:16.6371553Z - C:\npm\cache\_npx\5920\node_modules\mocha\bin\mocha
2020-10-12T22:38:16.6371883Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-10-12T22:38:16.6372236Z at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-10-12T22:38:16.6372757Z at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-10-12T22:38:16.6373259Z at require (internal/modules/cjs/helpers.js:72:18)
2020-10-12T22:38:16.6373925Z at Object.<anonymous> (D:\a\r1\a\Test_IND-CI \drop\Selenium IDE\test.js:2:37)
2020-10-12T22:38:16.6374606Z at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-10-12T22:38:16.6374983Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-10-12T22:38:16.6375320Z at Module.load (internal/modules/cjs/loader.js:985:32)
2020-10-12T22:38:16.6375644Z at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-10-12T22:38:16.6375999Z at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-10-12T22:38:16.6382142Z at require (internal/modules/cjs/helpers.js:72:18)
2020-10-12T22:38:16.6382865Z at Object.exports.requireOrImport (C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js:20:12)
2020-10-12T22:38:16.6385244Z at Object.exports.loadFilesAsync (C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js:33:34)
2020-10-12T22:38:16.6385856Z at Mocha.loadFilesAsync (C:\npm\cache\_npx\5920\node_modules\mocha\lib\mocha.js:427:19)
2020-10-12T22:38:16.6387258Z at singleRun (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run-helpers.js:156:15)
2020-10-12T22:38:16.6388582Z at exports.runMocha (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run-helpers.js:225:10)
2020-10-12T22:38:16.6389265Z at Object.exports.handler (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run.js:366:11)
2020-10-12T22:38:16.6390655Z at C:\npm\cache\_npx\5920\node_modules\mocha\node_modules\yargs\lib\command.js:241:49
2020-10-12T22:38:16.6391922Z npm ERR! Test failed. See above for more details.
2020-10-12T22:38:16.6590665Z ##[warning]Couldn't find a debug log in the cache or working directory
2020-10-12T22:38:16.6612445Z ##[error]Error: Npm failed with return code: 1
This is the settings of my npm install task:
Azure Devops Failing on npm install (Cannot find module 'Selenium-Webdriver'
According to the error message:
Error: Cannot find module 'selenium-webdriver'
And the configuration screenshot of the build definition, we could to know that you execute the npm test directly without the packages. we need to use npm install command line to ensure that all the packages are installed:
npm install selenium-webdriver --save or npm install
You could check this thread for some more details.
I am trying to use the angular-cli project however I get this error when I run
$ ng new scotchy-scotch
C:\Users\....\AppData\Roaming\nvm\v0.12.10\node_modules\angular-cli\bin\ng:7
const resolve = require('resolve');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
From the angular-cli github page:
Prerequisites:
Both the CLI and generated project have dependencies
that require Node 4 or higher, together with NPM 3 or higher.
The const are part of ES6(ECMAscript 2015) which is not enabled by default in nodejs v0.12(which one you use). Related stackoverflow article
I updated webdriver-manager from version 10.0.1 to version 10.0.2, and since then I get the following error when I run the update command:
$ webdriver-manager update
webdriver-manager: using global installed version 10.0.2
[09:10:50] E/config - nothing to return for a config file
assert.js:89
throw new assert.AssertionError({
^
AssertionError: missing path
at Module.require (module.js:352:3)
at require (internal/module.js:12:17)
at Function.Config.binaryVersions (/usr/local/lib/node_modules/webdriver-manager/built/lib/config.js:82:26)
at /usr/local/lib/node_modules/webdriver-manager/built/lib/binaries/chrome_driver.js:47:51
at Object.<anonymous> (/usr/local/lib/node_modules/webdriver-manager/built/lib/binaries/chrome_driver.js:51:2)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
I get this both locally and on travis. Any idea what could be the issue?
Just looked at the history on these releases. The first working release that Protractor used was webdriver-manager 10.0.4. I believe 10.0.1 and 10.0.2 still had a few issues. Please use the latest. The latest release is 12.0.4 and it should have the fix for this issue.