I installed jest on my node js project with : npm install --save-dev jest.
I added jest in the script of package.json:
"scripts": {
"start": "node app/index.js",
"dev": "nodemon app/index.js",
"test": "jest"
}
I try launching jest with the commande: npm run test but I always get this error:
PS P:\Projets Angular\dblogwebapp\back-end> npm run test
> back-end#1.0.0 test
> jest
Error: EPERM: operation not permitted, realpath 'myPath\back-end'
at Function.realpathSync.native (node:fs:2550:3)
at tryRealpath (myPath\back-end\node_modules\jest-util\build\tryRealpath.js:26:39)
at Object.<anonymous> (myPath\back-end\node_modules\jest-resolve\build\resolver.js:124:49)
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)
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> (myPath\back-end\node_modules\jest-resolve\build\index.js:9:40)
Can anyone help me plz. thanks
Related
EDIT: My problem is solved. Link for solution
First of all, hello everyone,
Although dependencies and dev dependencies are specified in the package.json file (I also downloaded the modules to the node_modules folder with the npm install command), I get the following error when I enter the npx parcel index.html command. What would be the reason?
"devDependencies": {
"#parcel/transformer-sass": "^2.6.0",
"parcel": "^2.6.0"
},
"dependencies": {
"bootstrap-icons": "^1.8.3"
}
Console output:
PS C:\Users\ubeyd\GitHub\countrypedia> npx parcel index.html
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Error: The specified module could not be found.
\\?\C:\Users\ubeyd\GitHub\countrypedia\node_modules\#parcel\source-map\parcel_sourcemap_node\artifacts\index.win32-x64-msvc.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189: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 (C:\Users\ubeyd\GitHub\countrypedia\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object.<anonymous> (C:\Users\ubeyd\GitHub\countrypedia\node_modules\#parcel\source-map\parcel_sourcemap_node\index.js:15:18)
at Module._compile (C:\Users\ubeyd\GitHub\countrypedia\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}
I creact app using react. I usually use yarn start to run my app.
Error messege is "cannot find #babel/register" but there is on the package.json.
In my package.json
"#babel/register": "^7.6.2"
my index.js
require('#babel/register');
module.exports = require('./server.js');
Error
> reactjs-simple-boilerplate#1.0.0 start
> node src/server/index.js
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '#babel/register'
Require stack:
- /Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js'
]
}
npm install --save-dev #babel/register is not works for me.
After run this code, I got npm ERR! code EINTEGRITY
Not sure I can help 100% with the given information, but try running the following:
rm -rf node_modules package-lock.json yarn.lock; npm i
That will not only remove your modules, but it'll also remove eventual lock files which are used as conformity for your module versions; It could happen they mismatched versions between installations causing the above error, thus by removing and reinstalling you should solve the problem.
If that's not the case, you might have something off on your package.json, which you'd need to share in order to debug further
I am trying to deploy a nodejs application (which also uses typeORM) written in typescript to heroku.
My package.json devDependencies look like the following:
"devDependencies": {
"#types/cors": "^2.8.9",
"#types/node": "^8.10.66",
"nodemon": "^2.0.6",
"ts-node": "3.3.0",
"typescript": "3.3.3333"
},
and my scripts section look like so:
"scripts": {
"start": "node build/server.js",
"build": "tsc",
"postinstall": "npm run build",
"dev": "nodemon --exec ts-node src/server.ts"
}
I've set build to "tsc" so that Heroku compiles the typescript and specified the files to go inside the build folder, however when starting the server and running the tail log using heroku logs --tail, it seems to be trying to use my .ts files and it gives the error like below:
2021-01-03T22:30:28.445473+00:00 app[web.1]: Error: /app/src/entities/User.ts:1
2021-01-03T22:30:28.445474+00:00 app[web.1]: import { Person } from "./Person";
2021-01-03T22:30:28.445475+00:00 app[web.1]: ^^^^^^
2021-01-03T22:30:28.445475+00:00 app[web.1]:
2021-01-03T22:30:28.445479+00:00 app[web.1]: SyntaxError: Cannot use import statement outside a module
2021-01-03T22:30:28.445480+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:915:16)
2021-01-03T22:30:28.445480+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:963:27)
2021-01-03T22:30:28.445481+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2021-01-03T22:30:28.445482+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2021-01-03T22:30:28.445482+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2021-01-03T22:30:28.445483+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2021-01-03T22:30:28.445483+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2021-01-03T22:30:28.445484+00:00 app[web.1]: at /app/node_modules/typeorm/util/DirectoryExportedClassesLoader.js:41:39
2021-01-03T22:30:28.445484+00:00 app[web.1]: at Array.map (<anonymous>)
2021-01-03T22:30:28.445485+00:00 app[web.1]: at Object.importClassesFromDirectories (/app/node_modules/typeorm/util/DirectoryExportedClassesLoader.js:41:10)
2021-01-03T22:30:28.445704+00:00 app[web.1]: Cannot use import statement outside a module
Also note that i don't have a Procfile as it handles it by default.
Is there some other information i am missing to include?
Thanks
I have trouble with installing sqlite3 in electron 8.1
I got following errors
Error: Cannot find module 'D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\binding\electron-v8.1-win32-x64\node_sqlite3.node'
Require stack:
- D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\sqlite3.js
- D:\TASK(2020.1.1~)\AMS\main.js
- D:\TASK(2020.1.1~)\AMS\node_modules\electron\dist\resources\default_app.asar\main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7595:16)
at Module._load (internal/modules/cjs/loader.js:691:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\TASK(2020.1.1~)\AMS\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)
I installed npm install sqlite3 --build-from-source --runtime=electron --target=8.0.2 --dist-url=https://atom.io/download/electron
But no luck. Please help me.
Finally, I figured out and solved.
needed to followings
"scripts": {
"start": "electron .",
"postinstall": "electron-builder install-app-deps",
"package": "electron-packager . --production"
},
after that, npm run postinstall
it worked for me.
Error: Cannot find module 'once'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/index.js:1:74)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I'm getting this error when I try running my server.js with nodemon. I looked in my node_modules folder and there is a 'once' folder in there. I tried
rm -rf node_modules
npm install
to remove the entire node_modules folder and reinstall but it didn't work. I also did
npm install --save once
and still didn't work.
This is package.json
{
"name": "FullMean_Friends",
"version": "0.0.1",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "latest",
"express": "~4.2.0",
"mongoose": "latest"
}
}