I'm getting the below error while running ng new. Tried with cmd opening as Administrator, but not helping.
D:\Training\Angular>ng new test
internal/modules/cjs/loader.js:797
throw err;
^
Error: Cannot find module 'symbol-observable'
Require stack:
- C:\Users\mubarakm\AppData\Roaming\npm\node_modules\#angular\cli\lib\init.js
- C:\Users\mubarakm\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:687:27)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:849:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
at Object.<anonymous> (C:\Users\mubarakm\AppData\Roaming\npm\node_modules\←[4m#angular←[24m\cli\lib\init.js:10:1)
←[90m at Module._compile (internal/modules/cjs/loader.js:956:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:812:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:724:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:849:19)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\mubarakm\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\lib\\init.js'←[39m,
←[32m'C:\\Users\\mubarakm\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\bin\\ng'←[39m
]
}
npm i --save symbol-observable (or Yarn, then, Yarn add symbol-observable)
npm install (or Yarn)
npm outdated (or yarn outdated) to check for outdated dependencies(symbol-observable) then upgrading it to the corresonding version if needed by entering yarn upgrade symbol-observable #[version]
Else,
check if you import it correctly from
import { Observable } from 'rxjs/Observable';
to
import { Observable } from 'rxjs';
otherwise,you may have Rxjs issues as mentionned here https://github.com/angular/angular-cli/issues/4756
Simply check for any outdated dependencies using "npm outdated", and if there are any update the angular cli using command "npm update -g #angular/cli", should be good to go.
Related
for the past couple of days now, I've been trying to install react native using npx react-native init AppName, and since then I've been getting this error. I've searched the net and couldn't get a better answer to this problem, how do i go about solving it?
node:
internal/modules/cjs/loader:959
throw err;
^
Error: Cannot find module 'graceful-fs'
Require stack:
- C:\Users\HP\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js
- C:\Users\HP\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\bin.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at _gracefulFs (C:\Users\HP\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:19:39)
at Object.<anonymous> (C:\Users\HP\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:30:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\tools\\gracefulifyFs.js',
'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\bin.js'
]
}
I had the same problem.
sudo npm install
solved it for me.
I am trying to manually run lifecycle scripts of node_module dependencies for a project with npm --prefix <path> run <lifecycle script> after running npm -w <workspaces> ci --ignore-scripts.
I am attaching a part of log outputs of the scripts I wrote below.
...
Running prepare in node_modules/node-fetch
sh: 1: cross-env: not found
sh: 1: cross-env: not found
Running prepare in node_modules/#graphql-eslint/eslint-plugin/node_modules/cross-fetch
sh: 1: husky: not found
sh: 1: husky: not found
Running prepare in node_modules/sync-fetch
sh: 1: browserify: not found
sh: 1: browserify: not found
Running prepare in node_modules/#iarna/toml
> #iarna/toml#2.2.5 prepare
> npm run setup-burntsushi-toml-suite && npm run setup-iarna-toml-suite
> #iarna/toml#2.2.5 setup-burntsushi-toml-suite
> [ -d test/burntsushi-toml-test ] || (git clone https://github.com/BurntSushi/toml-test test/burntsushi-toml-test; rimraf test/burntsushi-toml-test/.git/hooks/*); cd test/burntsushi-toml-test; git pull
Already up to date.
> #iarna/toml#2.2.5 setup-iarna-toml-suite
> [ -d test/spec-test ] || (git clone https://github.com/iarna/toml-spec-tests -b 0.5.0 test/spec-test; rimraf test/spec-test/.git/hooks/*); cd test/spec-test; git pull
Already up to date.
Running prepare in node_modules/camel-case
Running prepare in node_modules/pascal-case
Running prepare in node_modules/yargs
Running prepare in node_modules/lower-case
Running prepare in node_modules/no-case
Running prepare in node_modules/#graphql-tools/utils/node_modules/camel-case
Running prepare in node_modules/send/node_modules/mime
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
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: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
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: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
...
Running prepare in /node_modules/#storybook/addon-actions
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
...
Based on the log, it seems like npm --prefix <path> run <lifecycle script> is often trying to run scripts that does not exist or use commands not installed, and thus fails.
Since some lifecycle scripts removes some codes and tries to rebuild them, I am also failing to build services in my root project.
I was suspecting this might be because
npm ci uses hoisting
dependencies have outdated lifecycle scripts in their package.json's
but after thinking, I don't think neither would be the case and this shouldn't be happening, because npm runs lifecycle scripts after npm ci in the background, and I was able to build services successfully when I used npm -w <workspaces> ci
I am new to react-native programming and getting issues when creating a new react native project (npx react-native init AwesomeProject)
I have followed the steps listed here:
https://reactnative.dev/docs/environment-setup
OS: Windows | node: v16.14.2 | npm: 8.7.0 | chocolatey: 1.1.0
Error message:
C:\Users\Arvin>npx react-native init AwesomeProject
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './lib/source-map-generator'
Require stack:
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\source-map\source-map.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\generator\lib\source-map.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\generator\lib\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\traverse\lib\path\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\traverse\lib\context.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\traverse\lib\traverse-node.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#babel\traverse\lib\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro-source-map\src\generateFunctionMap.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro-source-map\src\source-map.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\DeltaBundler\Serializers\sourceMapGenerator.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\DeltaBundler\Serializers\sourceMapString.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\lib\getAppendScripts.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\DeltaBundler\Serializers\baseBytecodeBundle.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\Server.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\metro\src\shared\output\bundle.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\node_modules\#react-native-community\cli-plugin-metro\build\commands\bundle\buildBundle.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\node_modules\#react-native-community\cli-plugin-metro\build\commands\bundle\bundle.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\node_modules\#react-native-community\cli-plugin-metro\build\commands\bundle\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\node_modules\#react-native-community\cli-plugin-metro\build\commands\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\node_modules\#react-native-community\cli-plugin-metro\build\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\commands\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\index.js
- C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\bin.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Arvin\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\source-map\source-map.js:6:30)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157: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) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\source-map\\source-map.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\generator\\lib\\source-map.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\generator\\lib\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\traverse\\lib\\path\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\traverse\\lib\\context.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\traverse\\lib\\traverse-node.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#babel\\traverse\\lib\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro-source-map\\src\\generateFunctionMap.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro-source-map\\src\\source-map.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\DeltaBundler\\Serializers\\sourceMapGenerator.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\DeltaBundler\\Serializers\\sourceMapString.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\lib\\getAppendScripts.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\DeltaBundler\\Serializers\\baseBytecodeBundle.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\Server.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\metro\\src\\shared\\output\\bundle.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\node_modules\\#react-native-community\\cli-plugin-metro\\build\\commands\\bundle\\buildBundle.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\node_modules\\#react-native-community\\cli-plugin-metro\\build\\commands\\bundle\\bundle.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\node_modules\\#react-native-community\\cli-plugin-metro\\build\\commands\\bundle\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\node_modules\\#react-native-community\\cli-plugin-metro\\build\\commands\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\node_modules\\#react-native-community\\cli-plugin-metro\\build\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\commands\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\index.js',
'C:\\Users\\Arvin\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\bin.js'
]
}
I have tried removing the node modules and executed 'npm install' but to no avail. Also tried the following:
npm install -g npm-check-updates
ncu -u
npm update
npm install
Your help will be greatly appreciated.
Thanks in advance.
I have 3 packages A, B, C, and the i'm developing in requires that package A has B and C as dependecies, but the problem here is that package C also depends on package B, below block describing the case.
So i was thinking of having Package B as peer dependecy inside A,C, but this way it doesn't work, when i tried to run for ex unit test on package A, it always will fail
Start testing for: /\.main.spec.js?/
module.js:549
throw err;
^
Error: Cannot find module 'B/user/model'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\workspace1\A\node_modules\#comp\C\lib\form\container.js:13:14)
at Module._compile (module.js:652:30)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .js] (D:\workspace1\A\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\workspace1\A\node_modules\#comp\C\lib\index.js:12:18)
at Module._compile (module.js:652:30)
at Module._extensions..js (module.js:663:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
Package A package.json file
"dependencies": {
"#comp/C": "0.0.1"
}
"peerDependencies": {
"#comp/B": "0.0.1"
}
Package C package.json file
"peerDependencies": {
"#comp/B": "0.0.1"
}
Beside that in Package C, i'm not import B functions from the package directly
like
import X from '#comp/C'
rather i'm using absolute path for the module like:
import X from 'C/X'
and then in webpack i'm using alias for package C,
alias:{
'C': path.resolve(__dirname, './node_modules/#comp/C/lib/app')
}
for local development it works correctly, but if pushed the packages and tried to use them as a single package (package A) it won't work and will give the above npm error.
I'm i doing it right, or is there another way to handle this case?
I'm having trouble getting gulp to read my modules.
Initially I had a working system.
I then upgraded to with NVM (I removed everything installed with Brew first)
Here's what I have now:
"node: v6.11.2"
"npm: 3.10.10"
"nvm"
and I have a gulpfile which used to work, but I also upgraded my modules, and I have installed locally in my project:
"gulp": "^3.9.1",
"gulp-pug": "^3.3.0",
"gulp-sass": "^3.1.0"
globally for this version of node I do have:
gulp-cli#1.4.0
jshint#2.9.5
npm#3.10.10
in a simple gulpfile running: gulp would work successfully, but introducing other modules is where I started getting issues.
In my gulpfile I have for example:
var gulp = require('gulp');
var sass = require(' gulp-sass'),
prefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-clean-css'),
sourcemaps = require('gulp-sourcemaps'),
rename = require("gulp-rename");
gulp.task('sass', function () {
return gulp.src(src.sass)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(prefixer())
.pipe(gulp.dest(src.css))
.pipe(minifycss())
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write('/maps'))
.pipe(gulp.dest(src.css))
.pipe(connect.reload());
});
..locally running any command like gulp sass would produce:
Error: Cannot find module ' gulp-sass'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/myusername/sites/projectname/gulpfile.js:25:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I've removed the node_modules, removed the dependancies in package.json, reinstalled each local module
' gulp-sass' should be 'gulp-sass'
You are injecting a package with an additional space in the beginning of the package name. Remove the space and try it again.
var sass = require(' gulp-sass'),
should be
var sass = require('gulp-sass'),