I have an NPM project called my-config that is a dependency of my-api. Inside of my-config, I have the line:
instance.configs.aws = ini.parse(fs.readFileSync('./etc/aws-config.ini', 'utf-8'));
This fetches the aws-config.ini in the etc folder of the my-config dependency.
However, when I run my-api, it fails with an error, saying that it cannot locate the ini file:
Error: ENOENT: no such file or directory, open './etc/aws-config.ini'
How do I reference this folder etc that exists in my dependency, from my main project that depends on it?
Can you just try ini.parse(fs.readFileSync('etc/aws-config.ini', 'utf-8')); ?
I prefixed the path with __dirname and it seems to be working, but I haven't received a successful runtime validation yet.
ini.parse(fs.readFileSync(__dirname + '/etc/aws-config.ini', 'utf-8'));
Related
I am trying to create a migration script on an existing project with already initialized migrate-mongo. I'm using windows btw.
Here is my problem.
When I try to create a script using this command migrate-mongo create blacklist_the_beatles
I get this error.
ERROR: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js' Error: ENOENT: no such file or directory, lstat 'C:\Users\saadb\AppData\Roaming\npm\node_modules\migrate-mongo\samples\undefined\migration.js'
I am running the command from VS code terminal. Is this right or should I run it from somewhere else
Just add moduleSystem property in your migrate-mongo-config.js
It can be esm or commonjs, depends on which one you using. More details here - https://github.com/seppevs/migrate-mongo/blob/49e6de971bc9581ce3a2321da2180a7877aff3a6/samples/esm/migrate-mongo-config.js
Running the following code solved the problem:
npx migrate-mongo create blacklist_the_beatles
Seems very weird, buy I was able to solve the issue by manually creating "undefined" folder in the prompted path, and I also put there all files from commonjs folder.
I have a react-nodejs app which builds fine locally but when pushing to Heroku it returns an error:
remote: error https://registry.yarnpkg.com/#privacyresearch/libsignal-protocol-protobuf-ts/-/libsignal-protocol-protobuf-ts-0.0.8.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, open '/tmp/yarncache.96jam/v6/npm-#privacyresearch-libsignal-protocol-protobuf-ts-0.0.8-5f8c6f70b1f50805b06fa38d81c0994f82e8562f-integrity/node_modules/#privacyresearch/libsignal-protocol-protobuf-ts/LICENSE'"
Here's my package.json file.
I read through several related questions and it seems like the root cause might be related to having a github url in the package.json. Given that it is also a hard dependency for me, I don't know how to proceed. Any help will be appreciated!
Try yarn install --network-concurrency 1
And try adding a .yarnrc file to the project with following line: network-concurrency 1
Full error message:
../assets/around/TCircle.svg
Module build failed: Error: Couldn't find preset "react-server" relative to directory "/Users/admin/Documents"
at Array.map (native)
I'm getting the error above over and over, but there's no single mention of react-server in the whole project's directory.
What I'm trying to accomplish is to link assets directory as an npm dependency, and access them throughout the project.
Also (this may sound silly) - but it works perfectly on others' machines.
I encountered this same issue. In my case, there was a .babelrc file in the parent directory that included the react-server preset. Deleting the .babelrc file in the parent directory solved the problem.
This is the expected lookup behavior according to Babel's docs.
I recently started on ember JS.
I am trying to import bootstrap.css file from "node_modules\bootstrap\dist\css\bootstrap.css"
But when i run the server its shows error like
Error: ENOENT: no such file or directory, open 'E:\For Saving\ember\project2\new_project\tmp\simple_concat-input_base_path-JBlVqJm6.tmp\node_modules\bootstrap\dist\css\bootstrap.css'
It is adding some path with my path and giving me this error. I search a lot to solve this but i can't. And Also i installed the bower via npm and the bower_component is not getting added into my project folder.
Last thing I am not good with command Line Interface. can i run ember without terminal?
You can't app.import node modules files. It's only for bower components and vendor folder.
Reference from ember-cli documentation.
I have written a NPM module. which needs to read a file. While creating NPM module I have placed a file in same directory with .js file and used
var file = './sqlmap_config.json';
This files gets included well when I use the code standalone. When I create NPM module, this file is looked up in parent directory where NPM module is installed and code fails.
Do I need to hard code it to
var file = './node_modules/module/sqlmap_config.json';
Or there is any other way to accomplish this
I think you are going to want to use something like :
var file = __dirName + '/sqlmap_config.json';
https://nodejs.org/api/all.html#modules_dirname