I have created a angular project with Angular CLI: 1.6.3 Node: 9.4.0
OS: linux x64 version. But when want to run my angular app with command ng serve then fetch this error
Cannot find module '#angular-devkit/core'.
Try the following steps,
Step 1:
npm update -g #angular/cli
Step 2:
Edit your package.json changing the line
"#angular/cli": "1.6.0",
to
"#angular/cli": "^1.6.0",
STEP 3:
npm update
Refer the steps
try this out
npm install #angular-devkit/core --save-dev
https://github.com/angular/devkit/issues/256
try to update your angular cli
https://github.com/angular/angular-cli/issues/9307
Step1: Edit your package.json changing the line
#angular/cli": "1.6.4"
to
#angular/cli": "^1.6.4"
Step2:
npm update -g #angular/cli
Step3:
npm install --save-dev #angular/cli#latest
I was facing the exact same problem. These three did the tasks for me. You may like to see https://github.com/angular/angular-cli/issues/9307
This can happen on different versions on angular-cli.
You can install it manually with
npm i -D #angular-devkit/core
-D is shortcut to --save-dev
Or try the latest version of angular cli
npm install --save-dev #angular/cli#latest
package.json, change to "#angular/cli": "^1.6.5",
"devDependencies": {
"#angular/cli": "^1.6.5",
"#angular/compiler-cli": "^5.0.0",
Important, the version could be vary depends on what time.
You really should run
npm update -g #angular/cli
first, to get version, my is 1.6.5
What does the "^" do?
~1.0.2 means to install version 1.0.2 or the latest patch version such as 1.0.4.
^1.0.2 means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.
last, run this
npm update
Just run:
npm install --save-dev #angular/cli#latest
In the project folder, to fix it.
I did it by deleting package-lock.json and the node_modules folder. After that run "npm install" and start the application again.
You can do
First,
Delete the node_modules folder
Run npm install
And add devkit to your dev dependancies with npm i -D #angular-devkit/core
Step 1: delete package-lock.json
Step 2: npm update -g #angular/cli
Step 3: update #angular/cli new version in package.json
Step 4: npm install
It worked for me.
I only installed my angular/cli using:
npm install -g #angular/cli#1.5.2
And I started getting this error.
Solution:
If your version is global and
If you don't mind the version of your angular/cli then type:
npm update -g #angular/cli
for me adding #angular-devkit/core solved the issue
npm install --save-dev #angular-devkit/core
I had this same error after updating some packages.
In my package.json I had the most current '#angular-devkit/core'
Using the standard solution to many problems:
rm -R node_modules/
npm install
And I updated the #angular/cli
npm install --save-dev #angular/cli#latest
and finally:
npm start
Only change "#angular/cli": "1.6.4", to "#angular/cli": "^1.6.4", and update npm with: npm update
Related
Using n to switch Node versions.
I've ran yarn, npm rebuild node-sass --force many many times. And still fails. Getting this error:
Node Sass could not find a binding for your current environment
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
Anyone have any idea how to fix?
Also..
When running this command..
npm rebuild node-sass --force
I get..
npm WARN using --force I sure hope you know what you are doing.
Doens't seem like it is doing anything..
I did below to resolve the issue.
npm uninstall node-sass
npm i node-sass
npm rebuild node-sass
remove node-sass from your command and just run npm rebuild --force
If npm rebuild node-sass and npm rebuild node-sass --force doesn't work. Just uninstall node-sass and install again.
I have tried all options like:
npm rebuild --force
npm rebuild node-sass --force
npm rebuild node-sass &
also did try to install through Python &
updated VS Project links, but nothing worked..
EXCEPT running it manually:
node node_modules/node-sass/scripts/install.js
The main issue is that your node-sass and node-npm versions are incompatible.
Please see the chart on this site or on this.
So my suggestion is either adjust your node-npm version or adjust node-sass.
In my case I was using node-sassof version 4.9.4 with node version 8.12.0 and npm version 6.4.1, It was working fine without any issue, later on I got new system and I had installed the latest node(12.16.0) & npm(6.13.4) and issue started so I dug into this and found above links.
Hope this will help you.
I just ran the command npm install node-sass and my issue was resolved.
remove package-lock.json file
remove node_modules folder
then remove from package.json it devDependencies
"node-sass": "4...",
then
npm i node-sass -D
and
npm i
We are also facing the same issue many times, due to different versions of node and npm for numbers of web applications.
For that, we are just using the below command to take proper node-sass supported versions.
npm install node-sass or npm install node-sass -g
then try to rebuild the node-sass with,
npm rebuild node-sass or npm rebuild node-sass -f
After that all, if required then we can rebuild all packages and npm start or npm run watch and then the application is working properly.
try this, add/modify your package.json
"node-sass": "*",
and run
npm install
Uninstall and reinstall node-sass. Consider moving to dart sass because node-sass is now deprecated.
Switching Node version to 12.18.x worked for me.
I solved it with npm rebuild node-sass --force, in my case I had to do it as sudo
I literally just made a fresh installation of the Angular CLI in order to try it out and I don't have a clue on what's causing the following error on the command line:
PC:cobros Fran$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
95% emitting/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
callbacks[i](err, result);
^
TypeError: callbacks[i] is not a function
at Storage.finished (/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15)
at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9
at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/graceful-fs/polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:153:5)
This is the information I get returned when I try "ng -v" (In case it's useful at all):
Angular CLI: 1.6.8
Node: 8.9.0
OS: darwin x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
#angular/cli: 1.6.8
#angular-devkit/build-optimizer: 0.0.42
#angular-devkit/core: 0.0.29
#angular-devkit/schematics: 0.0.52
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.9.8
#schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
What does the 'enhanced-resolve' module even do?
Did I install angular wrong? I followed the instructions from https://github.com/angular/angular-cli and made sure I fulfilled the prerequisites.
EDIT: The issue is now fixed, so there is no need to use this workaround anymore.
Solution (workaround) found here
Add "copy-webpack-plugin": "4.3.0" to your package.json
Thanks #neshkatrapati
I had same problem and this command did miracle for me
npm install copy-webpack-plugin#4.3.1
This issue should now be resolved with v4.4.1 released just now.
https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v4.4.1
EDIT: The issue is now fixed, so there is no need to use this workaround anymore.
Happens after upgrading #angular/cli to 1.6.8.
Solution: Problem is with copy-webpack-plugin (https://github.com/webpack-contrib/copy-webpack-plugin/issues/217)
npm i copy-webpack-plugin#4.3.1 --save-dev helps
NOTE: Previous offered solution was to downgrade cli to 1.6.7, which does not help.
As stated here https://github.com/angular/angular-cli/issues/9550 it's a problem with copy-webpack-plugin.
It can be solved by doing npm install copy-webpack-plugin#4.3.0
Following github.com/angular/angular-cli/issues/9550 (thanks #oers for the link in the comments)
I just downgraded Anuglar CLI to version 1.6.7.
To do so, just type
npm uninstall -g #angular/cli
And once it finished install a previous version
npm install -g #angular/cli#1.6.7
NOTE: This will work but it is just a temporary solution, they probably -and hopefully- hot fix this.
EDIT: Actually I tried the wrong project which wasn't using CLI, tried again and it doesn't work, if you follow the github thread, it looks like a big thing, as it doesn't work with CLI 1.5.x nor 1.6.x (didn't tried with the others). It looks like the only thing we can do ATM is either debug through or sit and wait.
OOPS!
if npm install copy-webpack-plugin#4.3.1 doesn`t help try add in package.json:
"optionalDependencies": {
"copy-webpack-plugin": "4.3.1"
},
"resolutions": {
"copy-webpack-plugin": "4.3.1"
}
Edit
Just execute yarn upgrade.
There was a release of copy_webpack_plugin fixing the bug (4.4.1), so this should be preferred for resolving this issue. With npm, npm --depth 9999 update should do the trick to update all dependencies recursively.
Regarding the depth argument for npm update:
As of npm#2.6.1, the npm update will only inspect top-level packages. Prior versions of npm would also recursively inspect all dependencies. To get the old behavior, use npm --depth 9999 update
Original answer below:
Solution
rm -rf node_modules package-lock.json
npm i copy-webpack-plugin#4.3.1 -E -O
npm i
Explanation:
We remove node_modules and lockfile
We specify copy_webpack_plugin only as a peer dependency (option -O) and with an exact version (option -E)
We install node_modules
Try this command -> npm install copy-webpack-plugin#4.3.0 resolved my issue
run this command npm install copy-webpack-plugin#4.3.0
callbacks[i](err, result);
^
TypeError: callbacks[i] is not a function
solution:-
npm install copy-webpack-plugin#4.3.0
Try to uninstall and reinstall Angular CLI :
Global package:
npm uninstall -g #angular/cli
npm cache clean
if npm version is > 5 then usenpm cache verifyto avoid errors (or to avoid using --force)
npm install -g #angular/cli#latest
Local project package:
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev #angular/cli#latest
npm install
I want to update multiple npm dependecies and save them to the respective package.json dependency slot.
My package.json:
{
"dependencies": {
"gulp": "^3.0.0"
},
"devDependencies": {
"gulp-eslint": "^2.8.0"
}
}
So i want to run:
$ npm update gulp gulp-eslint
That's ok but how to save the newer versions both for gulp (dep) and gulp-eslint (devDep) respectively ?
I tried:
$ npm update gulp gulp-eslint --save
but gulp-eslint is devDependency actually must be saved there, how to do all this in 1 command line?
You can check the official documentation for npm-update and notice that there are different specifications according to the npm version you are using.
From the command line you can do:
$ npm update --save --dev
Note: Use sudo if your are on Linux or Mac.
You can also use Yarn, which is a new package manager, with this command:
yarn upgrade
https://yarnpkg.com/en/docs/cli/upgrade
I had installation issues of angular-cli on Windows 10 system.
The errors were related to Python dependencies and node-gyp. Something as below :
>execSync#1.0.2 install C:\Users\UserName\AppData\Roaming\npm\node_modules\angular-cli\node_modules\execSync
node install.js
[execsync v1.0.2] Attempting to compile native extensions.
{ Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:1007:11)
Update
this seems to be fixed in newer releases and this solution is no longer required.
mukesh51 eventually solved the problem.
the installation seems to work in these steps:
npm install -g node-gyp
npm install -g windows-build-tools
npm install -g #angular/cli
I took these steps from here.
Uninstall
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
Update Global package
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
I too faced the same issue initially when I installed angular directly using bash. The installation was error completely. Then I attempted to install locally in my project (without removing the global one). That appeared to have solved the problem but got an error on creating a new app.
So i uninstalled everything :
npm uninstall -g #angular/cli
and the reinstalled Angular using Windows Power Shell(as Admin)
npm install -g #angular/cli
This solved the entire problem! Hope it helps!
Use windows power shell to install angular-cli. It will run without any issues.
Windows 10 Solution
Look back at the trace of installation steps ... you may see that it found the Angular binary in the following location:
C:\Program Files\Git\usr\local\node_modules\#angular\cli\bin
I added an ENVT variable using this path and ng worked fine after that
I tried using npm install -g #angular/cli
npm downloaded files successfully and copied files to AppData but not able to use ng -v
After that, I tried following:
npm cache clean --force
Removes npm cache forcefully if you get warning using npm cache clean.
Then try
npm install -g #angular/cli#latest
I have successfully installed by trying the above solution in Windows10.
Both the CLI and generated project have dependencies that require Node 8.9 or higher, together with NPM 5.5.1 or higher.
try update node.js and npm
npm uninstall -g #angular/cli
npm install -g #angular/cli
if doesn't work:
Close the terminal, open a new one or use CMD or Git for windows instead.
After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ directory, I can see the gulp executable there.
Is there something wrong with my npm installation?
That's perfectly normal.
If you want gulp-cli available on the command line, you need to install it globally.
npm install --global gulp-cli
See the install instruction.
Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).
So you could add scripts to your package.json file:
{
"name": "your-app",
"version": "0.0.1",
"scripts": {
"gulp": "gulp",
"minify": "gulp minify"
}
}
You could then run npm run gulp or npm run minify to launch gulp tasks.
I solved the issue without reinstalling node using the commands below:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
I actually have the same issue.
This link is probably my best guess:
nodejs vs node on ubuntu 12.04
I did that to resolve my problem:
sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
I solved the issue removing gulp and installing gulp-cli again:
rm /usr/local/bin/gulp
npm install -g gulp-cli
if still not resolved try adding this to your package.js scripts
"scripts": { "gulp": "gulp" },
and run npm run gulp
it will runt gulp scripts from gulpfile.js
Installing on a Mac - Sierra - After numerous failed attempts to install and run gulp globally via the command line using several different instructions I found I added this to my path and it worked:
export PATH=/usr/local/Cellar/node/7.6.0/libexec/npm/bin/:$PATH
I got that path from the text output when installing gulp.
Tried with sudo and it worked !!
sudo npm install --global gulp-cli
I'm on lubuntu 19.10
I've used combination of previous answers, and didn't tweak the $PATH.
npm uninstall --global gulp gulp-cli
This removes any package if they are already there.
sudo npm install --global gulp-cli Reinstall it as root user.
If you want to do copy and paste
npm uninstall --global gulp gulp-cli && sudo npm install --global gulp-cli
should work
I guess --global is unnecessary here as it's installed using sudo, but I've used it just in case.
in my case there was only on issue, just put "gulp":"gulp" in the script portion, of package.json, and then use command npm run gulp.