I am trying to run Detox test and found this error "Cannot find module 'detox/runners/jest/adapter' from 'init.js'"
node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1
--testNamePattern='^((?!:ios:).)*$' FAIL e2e/firstTest.spec.js ● Test suite failed to run
Cannot find module 'detox/runners/jest/adapter' from 'init.js'
at Resolver.resolveModule (../node_modules/jest-resolve/build/index.js:191:17)
at Object.<anonymous> (init.js:3:13)
Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0
total Time: 1.27s Ran all test suites matching /e2e/i with
tests matching "^((?!:ios:).)*$". child_process.js:643
throw err;
^
Error: Command failed: node_modules/.bin/jest e2e
--config=e2e/config.json --maxWorkers=1 --testNamePattern='^((?!:ios:).)*$'
at checkExecSyncError (child_process.js:603:11)
at Object.execSync (child_process.js:640:13)
at runJest (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:135:6)
at run (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:78:7)
at Object. (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:180:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Command : detox test -c android.emu.debug
package.json:
{
"name": "sampleApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test-android": "detox build --configuration android.emu.debug && detox test --configuration android.emu.debug -l verbose"
},
"dependencies": {
"npm": "^6.1.0",
"react": "16.2.0",
"react-native": "0.53.3"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"detox": "7.4.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
},
"detox": {
"test-runner": "jest",
"specs": "e2e",
"runner-config": "e2e/config.json",
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_28_x86"
}
}
}
}
What could be the Problem? When I see my node_module >> detox folder, I could not see runner folder. Did I miss something?
Update your detox dependency to ^8.0.0.
Related
After the following steps
install a clean Vue3/Vite application as outlined in the docs (Vue application runs correctly)
install Storybook as describes in the docs
run Storybook (npm run storybook)
I run into the following error:
importers[path] is not a function
TypeError: importers[path] is not a function
at StoryStore2.importFn (http://localhost:6006/virtual:/#storybook/builder-vite/storybook-stories.js:6:31)
at StoryStore2.loadCSFFileByStoryId (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-WS7C7QNU.js?v=58e9ae5a:2297:19)
at StoryStore2._callee2$ (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-WS7C7QNU.js?v=58e9ae5a:2355:29)
at tryCatch (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-IKIHLHDP.js?v=58e9ae5a:46:44)
at Generator.invoke (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-IKIHLHDP.js?v=58e9ae5a:213:26)
at Generator.next (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-IKIHLHDP.js?v=58e9ae5a:87:25)
at asyncGeneratorStep2 (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-WS7C7QNU.js?v=58e9ae5a:2140:24)
at _next (http://localhost:6006/node_modules/.vite-storybook/deps/chunk-WS7C7QNU.js?v=58e9ae5a:2158:9)
What could be wrong here and how can this be solved?
Apparently the following steps will create a clean Vue 3/Vite/Storybook installation:
npm create vite#latest
Project name: <project name>
Select a framework: Vue
Select a variant: Typescript
cd <project name>
npm install
npx storybook init --builder #storybook/builder-vite --type vue3
npm install #storybook/builder-vite#0.3 --save-dev (mdx stories are not working with version 0.4)
npm run storybook
It creates the following package.json:
{
"name": "Test project",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"dependencies": {
"vue": "^3.2.45"
},
"devDependencies": {
"#babel/core": "^7.20.12",
"#storybook/addon-actions": "^6.5.16",
"#storybook/addon-essentials": "^6.5.16",
"#storybook/addon-interactions": "^6.5.16",
"#storybook/addon-links": "^6.5.16",
"#storybook/builder-vite": "^0.3.0",
"#storybook/testing-library": "^0.0.13",
"#storybook/vue3": "^6.5.16",
"#vitejs/plugin-vue": "^4.0.0",
"babel-loader": "^8.3.0",
"typescript": "^4.9.3",
"vite": "^4.1.0",
"vue-loader": "^16.8.3",
"vue-tsc": "^1.0.24"
}
}
When building my app for production,
running npm rum build I get an error.
Error
vite v3.0.7 building for production...
✓ 29 modules transformed.
[vite:import-glob] EPERM: operation not permitted, scandir 'C:\Documents and Settings'
file: C:/Users/…/src/views/Room.vue
error during build:
Error: EPERM: operation not permitted, scandir 'C:\Documents and Settings'
I am using Vue 3 + Vite, npm, VSCode.
Working fine in dev mode.
I tried this solutions but none worked:
reinstall npm, vscode, restarting, config prefix, run as admin, gitbash, full rights…
My code
inside script of Room.vue :
roomImages.value = import.meta.glob("../assets/rooms/romantique/*.(jpg|JPG|png|PNG)",{ as: "url" });
package.json
{
"name": "site-name",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 4173",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"#quasar/extras": "^1.15.1",
"pinia": "^2.0.17",
"quasar": "^2.7.7",
"vue": "^3.2.37",
"vue-router": "^4.1.3"
},
"devDependencies": {
"#quasar/vite-plugin": "^1.1.1",
"#rushstack/eslint-patch": "^1.1.4",
"#vitejs/plugin-vue": "^3.0.1",
"#vue/eslint-config-prettier": "^7.0.0",
"eslint": "^8.21.0",
"eslint-plugin-vue": "^9.3.0",
"prettier": "^2.7.1",
"sass": "^1.54.4",
"vite": "^3.0.4"
}
}
Any clues?
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:372:5)
at validateString (node:internal/validators:120:11)
at Object.extname (node:path:837:5)
at getOptions (C:\Users\skh43\Desktop\Тест сайт\node_modules\node-sass\bin\node-sass:228:40)
at Object.<anonymous> (C:\Users\skh43\Desktop\Тест сайт\node_modules\node-sass\bin\node-sass:408:15)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
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)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
Waiting for the debugger to disconnect...
PS C:\Users\skh43\Desktop\Тест сайт>
It says that the path should be a string, but no matter how much I try, I can't get it
Here is the file I was running
{
"name": "test_site",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"scss": "node-sass -watch scss -o css"
},
"author": "me",
"license": "ISC",
"dependencies": {
"node-sass": "^7.0.1",
"react-scripts": "^5.0.1"
}
}
I do not know what details I can add to the question so that it consists not only of code, but the site requires more text from me
I am using expo 34.0.1 for react native development. I am using TypeScript for the project and running tsc --project . --noEmit in a testing script with jest. That leads to the following error:
node_modules/#expo/vector-icons/build/createIconSet.d.ts:2:55 - error
TS7016: Could not find a declaration file for module
'./vendor/react-native-vector-icons/lib/create-icon-set'.
'../node_modules/#expo/vector-icons/build/vendor/react-native-vector-icons/lib/create-icon-set.js'
implicitly has an 'any' type.
2 export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from
'./vendor/react-native-vector-icons/lib/create-icon-set';
Found 1 error.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! # tsc-test: tsc
--project . --noEmit npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the # tsc-test script. npm ERR! This is probably not a problem with
npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/.npm/_logs/2019-08-31T19_25_49_598Z-debug.log
tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "es6",
"target": "es6",
"lib": ["es2016", "esnext.asynciterable"],
"jsx": "react-native",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["jest"],
"moduleResolution": "node",
"allowJs": false,
"esModuleInterop": true
},
"exclude": ["node_modules"]
}
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"test": "npm run tslint && npm run tsc-test && npm run jest",
"tslint": "tslint --project .",
"tsc-test": "tsc --project . --noEmit",
"jest": "jest"
},
"dependencies": {
"#types/enzyme": "^3.10.3",
"expo": "^34.0.1",
"moment": "^2.24.0",
"react": "16.9.0",
"react-dom": "^16.9.0",
"react-moment": "^0.9.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-elements": "^1.1.0",
"react-native-gesture-handler": "~1.3.0",
"react-native-reanimated": "~1.1.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.4",
"react-navigation": "^3.12.1"
},
"devDependencies": {
"#types/expo": "^32.0.13",
"#types/jest": "^24.0.18",
"#types/react": "^16.9.2",
"#types/react-test-renderer": "^16.9.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"jest": "^24.9.0",
"jest-expo": "^34.0.1",
"react-test-renderer": "^16.9.0",
"ts-jest": "^24.0.2",
"tslint": "^5.19.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.5.3"
},
"private": true,
"jest": {
"preset": "jest-expo",
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"**/__tests__/**/*.ts?(x)",
"**/?(*.)+(spec|test).ts?(x)"
],
"moduleFileExtensions": [
"js",
"ts",
"tsx"
],
"globals": {
"ts-jest": {
"tsConfig": {
"jsx": "react"
}
}
},
"setupFilesAfterEnv": [
"./src/setupTests.js"
]
}
}
Any ideas how to solve that?
Step 1:
Inside the "scripts" object in your package.json simply add:
"postinstall": "npx typesync"
The benefit of using npx here is that it doesn't require you to install anything on your machine.
Step 2:
Run yarn or npm install to effectively run the 'postinstall' script.
Once all your missing packages are added, you'll get a list of all the new typings to be added to your project
It may look something like this:
📦 yourAppNameHere — package.json (4 new typings added, 0 unused typings removed)
├─ + #types/babel__core
├─ + #types/react-native-vector-icons
├─ + #types/react
Step 3:
You will likely be asked to run npm install or yarn again, which will install the packages added and you will be good to go!
I can see that you are using eslint. So, it is safe to edit your compiler options and add
"noImplicitAny": false,
this will silence your error. And eslint will catch any implicit any in your code.
I hope this is correct from my understanding :-)
I tried to import Expo from 'expo'. But I am getting an error as:
error: bundling failed: Error: Unable to resolve module `expo` from `C:\Users\reactnative\navigate\App.js`: Module `expo` does not exist in the Haste module map.
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
at ModuleResolver.resolveDependency (C:\Users\reactnative\navigate\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:183:15)
at ResolutionRequest.resolveDependency (C:\Users\reactnative\navigate\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:\Users\reactnative\navigate\node_modules\metro\src\node-haste\DependencyGraph.js:273:16)
at Object.resolve (C:\Users\reactnative\navigate\node_modules\metro\src\lib\transformHelpers.js:261:42)
at dependencies.map.result (C:\Users\reactnative\navigate\node_modules\metro\src\DeltaBundler\traverseDependencies.js:391:31)
at Array.map (<anonymous>)
at resolveDependencies (C:\Users\reactnative\navigate\node_modules\metro\src\DeltaBundler\traverseDependencies.js:388:18)
at C:\Users\reactnative\navigate\node_modules\metro\src\DeltaBundler\traverseDependencies.js:261:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\Users\reactnative\navigate\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
Dependencies in package.json
{
"name": "navigate",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.58.5",
"react-navigation": "^3.3.2"
},
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}