I'm trying to run a project with npm start and then get the following error in a bunch of different components:
Module build failed: Error: Cannot find module 'node-sass'
Alright, I'm thinking and I run 'npm install node-sass', which then leaves me with the following error:
Error: EINVAL: invalid argument, open '/usr/app/client/node_modules/node-sass/package.json'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.Module._extensions..json (module.js:670:20)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/app/client/node_modules/node-sass/lib/extensions.js:7:9)
at Module._compile (module.js:653:30)
I don't know what it means or what I can do to resolve it, I tried commands like npm rebuild, npm uninstall and then install again, deleted the node_modules folder but that doesn't seem to do the trick.
I think this would work.
The package.json I have was written like the following.
"devDependencies": {
...
"node-sass": "^4.5.0",
...
}
npm install node-sass
npm install node-sass#latest
npm rebuild node-sass --force
npm install node-sass --force
Ok, so the solution to my specific problem was:
npm install node-sass --force
and then I had to do
npm rebuild node-sass --force
And then I got it to compile
Try running :
npm install node-sass --force
It would work.
npm install --unsafe-perm node-sass
in Linux:
sudo npm install --unsafe-perm node-sass
None of those options worked for me. I was trying to install node-sass version 4.14.1 and this seemed to work:
git clone --recursive https://github.com/sass/node-sass.git
cd node-sass
npm install
node scripts/build -f
cd ..
npm install node-sass --sass-binary-path=C:\Users<you-path>\node-sass\vendor\win32-x64-93\binding.node
That seemed to work for me. But then after all that effort, v.4.14.1 was incompatible with another package so I was ready to flip a table by that point < insert-table-flipping-meme >.
Related
I have just reinstall node.js, npm and angular-cli but this last one does not work on my PC running on Windows 10. The version of node.js is 8.1.2, the version of npm is 5.0.3. I installed angular-cli with the command line npm install -g #angular/cli. Now when I try any command line beginning with ng I have the error:
module.js:487
throw err;
^
Error: Cannot find module '#ngtools/json-schema'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Raphaël\AppData\Roaming\npm\node_modules\#angular\cli\models\config\config.js:6:23)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
Any idea what is wrong?
Shot in the dark, but I heard of -g installs interfering with local angular cli. However, this appears to just be a missing module from the download, maybe just a package lost. Try to uninstall and re-install again
I'm also on Windows 10. Node 8.1.4 and npm 5.2.0
What worked for me was following the steps from an issue thread I found on github: https://github.com/angular/angular-cli/issues/4425
. The link describes the following steps:
Uninstall angular cli
npm uninstall #angular/cli -g
Install rxJS
npm install rxjs -g
Cleared cache
npm cache clean
Manually deleted content in
%AppData%\npm\node_modules
Installed angular cli npm install
#angular/cli -g
Try downgrading node to v7 and npm to v4 then run:
rm -rf node_modules dist
npm cache clear --force
npm install
There are also some threads mentioning the removal of package.lock which is a new part of npm#5. Furhtermore it is worth checking you typescript version ensuring it is > 2.2.0.
I have installed the #angular/cli on my MacBook machine. Node server version is v6.9.5 and the npm version is 3.10.10. I have ran the following command to install the #angular/cli.
sudo npm install -g #angular-cli
When I run the ng help command or any command for ng. It shows me the following error
Parsing .angular-cli.json failed. Please make sure your .angular-cli.json
is valid JSON.
Error: SyntaxError: Unexpected token u in JSON at position 22
InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your
.angular-cli.json is valid JSON.
Error: SyntaxError: Unexpected token u in JSON at position 22
at InvalidConfigError (/usr/local/lib/node_modules/#angular/cli/models/config/config.js:10:9)
at Function.fromConfigPath (/usr/local/lib/node_modules/#angular/cli/models/config/config.js:77:19)
at Function.fromProject (/usr/local/lib/node_modules/#angular/cli/models/config.js:96:46)
at Object.<anonymous> (/usr/local/lib/node_modules/#angular/cli/commands/build.js:7:35)
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)
at Module.require (module.js:497:17)
I also uninstalled and #angualr/cli and clear the cache then reinstalled #angualr/cli. I run the following command.
sudo npm uninstall -g #angular-cli
npm cache clean sudo
npm install -g #angular-cli
Still the same issue is appearing.
The package is called #angular/cli, so do npm install -g #angular/cli.
#angular-cli is the previous version. Now you need to
npm install -g #angular/cli
to work with #angular/cli version
The package you mentioned is not valid. For fresh installation use npm install -g #angular/cli.
Check here for more details https://github.com/angular/angular-cli#installation
Also If you are upgrading follow this https://github.com/angular/angular-cli#updating-angular-cli
If you upgrading from a beta/RC version follow this https://github.com/angular/angular-cli/wiki/stories-1.0-update
angular-cli uses angular.cli.json.
whereas #angular/cli uses .angular.cli.json
i also face same issue, so i tried this method given below.
Clean uninstall of angular-cli, like npm uninstall -g angular-cli
Clone this angular-cli repo,
Go to the angular-cli repo folder, and run npm link,
Go to my project folder
Run npm link angular-cli
Now to run ng command, I use ./node_modules/angular-cli/bin/ng from my project folder
You need to install #angular/cli globally to use it anywhere.To install it globally use cmd 'npm i -g #angular/cli',where -g means globally.Even update your angular version to latest.I think the error is because in older versions of angular,the angular.json file name used to be saved differently and its name is differently saved in newer or latest versions,so after installation it might not be able to read your angular.json file.
Im on osx. I had a development with node, npm and ionic. Everything worked.
I accidentally run this command:
npm install -g ionic
After that Ionic is not working anymore. if I try to create a project or start an existing one I got this error:
Caught exception:
Error: Cannot find module 'inherits'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/glob/glob.js:42:14)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
npm -v gives:
3.10.8
node -v gives:
v6.4.0
ionic -v
gives the same error message as above.
Im not sure if I installed node/npm with brew or what else. Any ideas?
in my case , uninstalling and reinstalling the ionic worked .
1.npm uninstall -g ionic cordova
2.npm install -g ionic cordova
3.npm update minimatch
4.try reinstalling ionic using ionic#latest
This is because the module 'inherits' is missing which may be a problem with npm.
I'll simply suggest uninstalling and installing again as you may have downloaded corrupt/incomplete files.
On MacOS/Unix:
brew uninstall npm
sudo rm -rf /usr/lib/node_modules/
brew install npm
Then retry installing ionic
npm uninstall -g ionic
npm install -g ionic
Try again by adding “read and write” permission to your project root folder
Like
Ionic is my project root folder and under the ionic folder i have a app named ionicapp
I am trying to install the latest npm, following the instructions on the npm doc site.
My problem is that using command:
npm install -g npm
to get the latest version of NPM does not seem to work: it does not seem to install any of the needed dependencies, so when I run it I get errors such as:
module.js:340
throw err;
^
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/harmic/.node_modules/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I am using a Centos 6 machine, so I started by installing node + npm from EPEL, like this:
yum install nodejs npm
That went OK. I then went to install the latest npm, as recommended at the above link and many other pages I've seen. My first attempt
sudo npm install -g npm
was not so great, for two reasons:
It installed in /usr/lib/node_modules, over the top of the original RPM installation. I judged this to be extremely poor practice, because the next time I did yum update on the system there was every chance the newly installed files would be overwritten by whatever incoming RPM packages contained, leaving an unholy mess.
It did not work anyway: I could not start npm at all, it constantly complained of missing dependancies as described above.
So I uninstalled the RPMs, removed all the left over files, then reinstalled the RPMs again. This time I created a ~/.npmrc file and put this in it:
prefix = ${HOME}/.node_modules
I also set NODE_PATH environment variable to include that path. After this, npm did install itself in my desired location, but did not install any dependencies:
$ npm install -g npm
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/npm
/home/harmic/.node_modules/bin/npm -> /home/harmic/.node_modules/lib/node_modules/npm/bin/npm-cli.js
npm#3.3.3 /home/harmic/.node_modules/lib/node_modules/npm
Running it from the new installed path gave the error at the top of the page.
Despite thinking that I must be doing something seriously wrong, I set about trying to install the unmet dependencies, one at a time:
npm install -g are-we-there-yet
npm install -g gauge
npm install -g os-tmpdir
npm install -g os-homedir
npm install -g is-absolute
npm install -g asap
npm install -g path-is-absolute
npm install -g builtins
npm install -g validate-npm-package-license
npm install -g concat-stream
npm install -g json-parse-helpfulerror
npm install -g readdir-scoped-modules
npm install -g debuglog
npm install -g lodash._baseclone
npm install -g lodash._bindcallback
npm install -g lodash._baseflatten
npm install -g lodash._baseuniq
...
and still it complains about needing more.
Finally I have concluded that I must have missed something important, so I decided to ask for the help of the SO community...
The initially installed versions of node & npm RPMs are:
nodejs-0.10.36-3.el6
npm-1.3.6-5.el6
Oh and in case you are wondering, the reason I am trying to update npm in the first place is because when trying to install this package I ran into a build error, the solution to which is apparently to install an updated npm.
First of all I would suggest you to forget to install node with RPM/APT etc, the reason for this is because normally they have outdate versions. Infact 0.10 is very old, 0.12 is nearly a year old and now there's 4.1 already. So my suggestion is to use nvm https://github.com/creationix/nvm
nvm is a Node Version Manager. the cool think is that you can switch version with a single command and stay always updated. After installing the node version that you want, you can also upgrade npm.
You can even select a node version for a certain folder in your system (if you have code that runs just in an old version for example)
module.js:340
throw err;
^
Error: Cannot find module 'vinyl'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/morpheyesh/debugall/web-starter-kit/node_modules/gulp/node_modules/gulp-util/lib/File.js:1:80)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I have major issues with node.js. I try to run any nodejs application or gulp, i get this error, I try to install every module , I keep getting the same error and it requires a new module. Is there anyway where I can install all the modules?
Plus, I have install nodejs through npm? how to install system wide? Gulp is been installed system wide(global). What is causing this error?
nodejs -v gives v0.10.30
`npm -v gives 1.4.21
gulp 3.8.7
I am working with the google web starter kit. I installed nodejs using apt-get, then install sass, then installed gulp, then npm. Is there a way where I can remove all these and install all of it system wide?
Try updating your global gulp installation:
sudo npm install --global gulp#latest
It sounds like everything is (was?) FUBAR for a while there. If you have not yet solved these problems, here's what I would recommend.
First, the official (Debian/Ubuntu) packages are a bit behind latest node. I would recommend uninstalling the packages nodejs and nodejs-legacy and following the instructions here to get the latest versions (packaged and published by nodesource): https://github.com/nodesource/distributions#usage-instructions
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
Now you will have a recent node (0.10.35) but an out-of-date npm. Upgrade your npm:
npm install -g npm#latest
Things should now work for you; you should be able to run npm install in your project directory and all dependencies will be installed correctly.
One thing to be wary of is that you should never run npm update or npm update -g. This does not update the current (or all global) packages, as one might think.
Try this for install all plugins required by gulp :
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
Source : http://travismaynard.com/writing/getting-started-with-gulp
For me uninstalling gulp and then reinstalling it worked fine. This is with node v5.0.0
sudo npm uninstall -g gulp
npm install -g gulp