Sails.js missing modules - node.js

Experiencing npm module troubles using sails.js.
The first problem was - the contents of assets/ was not being replicated to .tmp/public as documentation indicates. There have been other errors as well.
Research has shown - there are missing modules, one of which is grunt. Doing a
npm install grunt
does make the .tmp/public start working.
But there have been other errors when trying to use the framework.
Install Details:
Server instance: Ubuntu 14.04.1 LTS
(recently deployed, no other changes to server except for node and sails.js)
node --version
v0.12.4
(built from sources)
npm -v
2.10.1
sails --version
0.11.0
sails installed using:
sudo npm install sails -g
Create a new application:
sails new testproject
cd testproject
npm list
produces a long list of missing npm modules to stderr:
npm ERR! missing: colors#~0.6.2, required by grunt#0.4.2
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-clean#0.5.0
npm ERR! missing: lodash#~2.4.1, required by grunt-contrib-coffee#0.10.1
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-coffee#0.10.1
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-concat#0.3.0
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-copy#0.5.0
and several others.
This seems inexplicable - how could this (missing npm modules) be overlooked? I am new to node - and could have missed something.
Reviewing the getting started page, I didn't notice anything obvious.
This framework seems well-designed - uses some great npm modules.
Has anybody experienced these and found what is needed to fix?

To resolve the missing: colors#~0.6.2, required by grunt#0.4.2 , just navigate to the node_modules/grunt, do a npm install to install the missing dependencies.

Related

Unable to resolve dependencies for Angular Universal

I need to use SSR for one of my existing angular project. For that, I have migrated one of my projects from v8 to v13.0.0, which itself took a lot of time.
HOwever, now that the app is running fine on v13.0.0, I tried adding SSR to it using
ng add #nguniversal/express-engine
This commands seems to add 13.0.1 of universal, but it keeps failing with errors similar to below one:
D:\my-app-universal>ng add #nguniversal/express-engine i Using package
manager: npm √ Found compatible package version:
#nguniversal/express-engine#13.0.1. √ Package information loaded.
The package #nguniversal/express-engine#13.0.1 will be installed and
executed. Would you like to proceed? Yes npm ERR! code ERESOLVE npm
ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR!
While resolving: my-app-universal#0.0.0 npm ERR! Found:
#angular/animations#13.0.3 npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~13.0.0" from the root project npm
ERR! npm ERR! Could not resolve dependency: npm ERR! peer
#angular/animations#"13.2.3" from #angular/platform-server#13.2.3 npm
ERR! node_modules/#angular/platform-server npm ERR! peer
#angular/platform-server#"^13.0.1" from
#nguniversal/express-engine#13.0.1 npm ERR!
node_modules/#nguniversal/express-engine npm ERR!
#nguniversal/express-engine#"13.0.1" from the root project npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this
command with --force, or --legacy-peer-deps npm ERR! to accept an
incorrect (and potentially broken) dependency resolution. npm ERR! npm
ERR! See
C:\Users\saurabhtiwari\AppData\Local\npm-cache\eresolve-report.txt for
a full report.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\saurabhtiwari\AppData\Local\npm-cache_logs\2022-02-20T12_03_46_821Z-debug.log
× Package install failed, see above.
I have tried a lot to read through the errors and updating package.json to match the required version of peers but it just doesn't go away.
Is there a systematic way to resolve these errors.
Is there a particular version of universal that might go well with Angular 13.
Any suggestions are welcomed.
I followed #misha130's comments advice and fixed the version numbers. I didn't need to need to install with --legacy-peer-deps or --force.
The solution was to upgrade #angular/cli & #angular/core.
With a fresh install, my initial version was 13.0.4. You will need to upgrade them one at a time as the update command fails if there are staged and uncommitted changes in the repository.
ng update #angular/cli
git add . && git commit -m 'nguniversal fix 1 - update #angular/cli'
ng update #angular/core
git add . && git commit -m 'nguniversal fix 2 - update #angular/core'
ng add #nguniversal/express-engine
Thanks everyone for their inputs in the comment. I figured it out as below.
As suggested in comments, first I installed the universal package using --legacy --per --deps
npm install #nguniversal/express-engine --save --legacy-peer-deps
This installed the packages in the node_modules, although the required express-server related files were not added.
To add those files, I then ran:
ng add #nguniversal/express-engine
This creates the required file. It will also try to install the package again and will fail in doing so. Since the package have been installed already, I guess you can ignore its error.

Cannot Install Any Package NPM Node-JS

The problem I face is when I will install one of the packages NPM is always show
[............] /roolbackFailedOptional: verb npm-session ....
and the final show error like :
npm ERR! code e503
npm ERR! 503 Service Unavailable:
npm ERR! A complete log of this run can be found in:
npm ERR! C:Users\.......\AppData\Roaming\npm-cache\_logs\2018-08-08t08_09_25_773Z-debug.log
I have already found a solution from here. But it didn't worked.
The configuration NodeJS in my system :
and i use version for
NodeJS : 10.8.0
npm : 6.2.3
Please help me for fixed my problem...
not sure if it will fix your issue but i used
npm install --proxy proxy_address:port install package_name --save
when i had troubles with proxy, if this works, then you might have configured npm settings not the way you need to.

Problems with npm versions of cordova project

I'm working on a Cordova Project.
In my project directory, if I type:
node -v I get v6.11.1
npm -v I get 3.10.10
Sometimes, after adding a new plugin to the project (e.g cordova-plugin-statusbar), it happens that when I build the project I get this error:
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-plugin-statusbar#^2.2.3 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
...
...
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/myuser/.nvm/versions/node/v6.11.1/bin/node" "/Users/myuser/myprojectfolder/node_modules/.bin/npm" "install" "cordova-plugin-statusbar#^2.2.3"
npm ERR! node v6.11.1
npm ERR! npm v2.15.12
npm ERR! code EPEERINVALID
So npm version is different from the above one.
Can the problem of the plugin fetching be linked to this difference in the versions detected?
And why this happens?
EPEERINVALID means that some packages are outdated, you'll have to update global using -g:
npm update -g
Else you could try re-installing cordova and npm:
npm uninstall -g cordova
npm uninstall
npm install
npm install -g cordova
Else if you use nvm as well? because if there's 2 different versions of npm it might be the case that you have to update npm while calling to the nvm.

npm install error with connect module

I have installed all dependencies related with this project https://github.com/msfrisbie/mean-stripdown.git.
with command "npm install".
and then I got the next errors related only with connect#2.9.0 module:
npm ERR! missing bytes#0.2.1 required by connect#2.9.0
npm ERR! missing qs#0.6.5 required by connect#2.9.0
npm ERR! missing uid2#0.0.2 required by connect#2.9.0
...
How is this possible?
The module you're trying to install requires Express, which requires Connect#2.9.0, which is unable to find the modules you're listing. Trying use npm cache clean and then reinstalling. If that doesn't work, you can alternately completely remove the node_modules folder.

error while installing gruntjs (node.js/npm package)

I'm trying to install grunt.js. As the official docs says, I should run
npm install -g grunt-cli
as root (I'm using ubuntu linux). I'm trying - and I get the following error:
$ sudo npm install -g grunt-cli
npm ERR! sudon't!
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm ERR! couldn't read package.json in .
npm ERR! Error installing .
npm ERR! Error: ENOENT, No such file or directory 'package.json'
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-#googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok
Can someone please explain:
[1] why npm says `sudon't` and grunt docs says `do sudo`? And what is it all about?
[2] I want to install the grunt as a tool. Why does the message complains about missing package.json which is project-dependent (and I don't want to run grunt on any project, I want to install it globally first)?
[3] what can I do to make it install successfully?
The solution was quite tricky... I'm using ubuntu oneiric ocelot, which was still maintained one week ago (it's not that old). I installed node.js through default ubuntu packages and it turned out to be the problem - I got 0.4.9 version installed, which seems to be old, odd and strange (I had no experience with node.js before). I removed it and followed instructions from https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager - added remote package repository and installed node.js from there. Now I've got a shiny 0.10.5 with sudo npm install working perfectly fine with no complaints.

Resources