I'm new to using gulp and browserify. I'm trying to follow a tutorial online which uses browserify and gulp.
Following is my package.json
{
"name": "progressive",
"version": "1.0.0",
"description": "Practcing a Progressive Web App",
"scripts": {
"start": "node ./index.js"
},
"author": "Indu Pillai",
"devDependencies": {
"browserify": "^13.1.0",
"gulp": "^3.8.8",
"gulp-browserify": "^0.5.1",
"gulp-clean-css": "^2.0.13",
"gulp-concat-css": "^2.3.0",
"gulp-if": "^2.0.1",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"gulp-util": "^2.2.20",
"gulp-webserver": "^0.8.8",
"jquery": "^3.1.1",
"sw-precache": "^4.2.1"
},
"dependencies": {
"handlebars": "^4.0.5"
}
}
When I run npm install, it gives me the following error:
npm WARN browserify-shim#2.0.10 requires a peer of browserify#>= 2.3.0 < 4 but none was installed.
I don't know how to solve this problem, I'm not good at npm stuff either. I didn't ask for browserify-shim in my package.json, but may be some of the packages I asked depends on it.
Thank You!
I have the same problem
and I solve it with the following:
If you use the windows you should
Download the :(Windows Binary.Zip)
Then choose the correct architecture to your computer (32 or 64),
make it active
Open Command Prompt as Administrator
Execute this on the command line: npm install -g #angular/cli
Related
Question
What is wrong with my Dockerfile or bitbucket-pipelines.yml? Why are modules missing from the bitbucket pipelines environment?
Error
When I try to npm run build my Vue2 project with webpack using Bitbucket Pipelines, I get errors regarding missing modules.
From Logs
npm run build
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module 'cli-spinners'
Files
Here are the files for configuration.
Dockerfile - builds cportwine/people-is
FROM node:8.10.0
RUN npm install
RUN npm install -g firebase-tools
CMD [ "npm", "run", "build" ]
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm run build
package.json
{
"name": "people-is",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "cportwine",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"deploy": "firebase deploy --token $FIREBASE_TOKEN"
},
"dependencies": {
"rxjs": "^5.5.8",
"uuid": "^3.2.1",
"vue": "^2.5.16",
"vue-json-excel": "^0.1.9",
"vue-router": "^2.8.1",
"vue-rx": "^5.0.0",
"vuefire": "^1.4.5",
"vuetify": "^0.15.2"
},
"devDependencies": {
"autoprefixer": "^7.2.6",
"babel-core": "^6.22.1",
"babel-loader": "^7.1.4",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.3.2",
"connect-history-api-fallback": "^1.5.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.16.3",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"firebase": "^4.12.0",
"firebase-tools": "^3.17.7",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"opn": "^5.3.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.4.0",
"rimraf": "^2.6.0",
"semver": "^5.5.0",
"shelljs": "^0.7.6",
"url-loader": "^0.5.8",
"vue-loader": "^13.7.1",
"vue-style-loader": "^3.1.2",
"vue-template-compiler": "^2.5.16",
"vuex": "^2.5.0",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-dev-middleware": "^1.12.2",
"webpack-hot-middleware": "^2.21.2",
"webpack-merge": "^4.1.2"
},
"engines": {
"node": ">=8.10.0",
"npm": ">= 5.6.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://chaddportwine#bitbucket.org/jahnelgroup/people-is.git"
},
"keywords": [],
"license": "ISC",
"homepage": "https://bitbucket.org/jahnelgroup/people-is#readme"
}
What I see
When I ls the node_modules folder in both environments, they do not match. Modules are missing from bitbucket pipelines.
local folder
people-is/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
...
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
Woah, missing modules!
...
chalk
cli-cursor
co
...
What I have tried
I added a command to the bitbucket-pipelines.yml to npm install before I build.
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm install
- npm run build
This adds some additional modules (like cli-spinners from the error) to /opt/atlassian/pipelines/agent/build/node_modules.
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
clone
clone-response
co
...
However, the build command still fails, due to a different missing module.
Error
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module './_safeGet'
Solutions
I can now build the app, but I don't know why!
1 - Simplify the Dockerfile
I removed all the npm commands. Maybe the npm install commands were redundant? There was no advantage using the Docker Image to pre-install npm packages.
2 - Remove Node_Modules before install
Using the bitbucket-pipelines.yml, remove the node_modules folder, and then perform npm install -g npm and npm install and npm install -g firebase-tools.
File Changes
bitbucket-pipelines.yml (added lines)
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- rm -r node_modules <---- remove
- npm install -g npm <---- install
- npm install <---- install
- npm install -g firebase-tools <---- install
- npm run build
Dockerfile (lines removed)
FROM node:8.10.0
<---- remove
CMD [ "npm", "run", "build" ]
Answer ?
I'm not sure why moving all the npm install stuff into the bitbucket.pipelines.yml solved my issue building the project. I thought Docker would enable me to define my environment, e.g., install a version of node/npm and firebase. And pipelines would "run" that.
If someone could explain what I am missing, I would accept that answer.
Answer
I received support from the Atlassian Team
Leave npm install -g firebase in the docker image.
Move npm install from the docker image to the
bitbucket-pipelines.yml file.
Reason
The node_modules folder was listed in .gitignore
tl;dr
My mistake - I forgot about .gitignore and how that affects the node_modules folder in source control, e.g., Bitbucket Pipelines.
I was looking at my local node_modules folder and building locally which worked.
However
The node_modules in source control, by design, is not in-sync with my local folder because it's included in the .gitignore file.
So
It was necessary for me to rm node_modules and npm install using the bitbucket-pipelines.yml. Now, BitPipes finds the modules I have installed locally.
This is sort of the point of maintaining the package.json, but I got confused.
When trying to npm install this exact package.json, npm hangs and becomes totally unreponsive.
{
"name": "My Project",
"description": "My Project",
"version": "1.0.0",
"private": true,
"main": "server.js",
"dependencies": {
"body-parser": "^1.15.2",
"compression": "^1.6.2",
"cors": "^2.8.0",
"loopback": "^2.31.0",
"loopback-boot": "^2.21.0",
"loopback-component-explorer": "^2.5.0",
"loopback-connector-mysql": "^2.3.0",
"loopback-connector-redis": "^0.0.3",
"loopback-datasource-juggler": "^2.50.0",
"loopback-ds-timestamp-mixin": "^3.4.0",
"mosca": "^2.1.0",
"mqtt": "^1.14.1",
"q": "^1.4.1",
"redis": "^2.6.2",
"serve-favicon": "^2.3.0",
"socket.io": "^1.4.8",
"socketio-auth": "0.0.5"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-docular": "^0.2.4",
"grunt-loopback-sdk-angular": "^1.2.0",
"jshint": "^2.9.3"
},
"scripts": {
"start": "node .",
"pretest": "jshint ."
}
}
I tested this on different clients, both using npm version 3.10.6 and node v6.5.0. I'm pretty sure it worked some days ago, but now, it just refuses to complete. I tried npm cache clean, tried lowering maxsockets down to 1, waiting for 20-30 minutes and tried to remove packages from packages.json, but finding the culprit it's a hit and miss. For example, "mosca" alone makes npm hang, but even when removed from package.json, it still won't finish.
The last message I see it's:
[ .....] - extract:socketio-auth: sill doParallel extract 852
and then just nothing. It doesn't give any error, even when setting logging level to silly. It just hangs forever. I really don't understand and I'm pretty sure it was working some day ago. Can someone help me? Does this package.json work for you?
I already checked this,this and this, but I think it's not related to them.
I't a known npm bug, still open... :-(
I'd rollback npm to 6.4 (which is #13782 bug free), till it's fixed...
I'm having issue while I'm installing MarkLogic. When I execute the command
npm install marklogic --save
I'm getting an error. It says
Refusing to install marklogic as a dependency of itself
package.json:
{
"name": "marklogic",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"express": "~4.13.4",
"jade": "~1.11.0",
"morgan": "~1.7.0",
"serve-favicon": "~2.3.0"
}
}
Checking -- if you cloned the MarkLogic Node.js API project, then ran the npm install command that you show above, I'd expect to see this error. Is that what's happening?
Edit: elevating #grtjn's point from the comment: When selecting a name for your package, it has to be unique. "marklogic" is the name of an existing package, and therefore conflicted with the same name used for the package you were building.
noob question regarding Node and npm: I have a package.json file with a list of dependancies that I want to install with npm install. When I run the command, nothing happens, I don't even receive an error, nothing at all :(
But if I try to install a single package from the list, it works perfectly...
I haven't created the package.json myself, so I am not sure what the "proxyURL" thing does...
{
"name": "dss",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "*urlofmyrepo*"
},
"dependencies": {
"bower": "^1.7.7",
"cssmin": "^0.4.3",
"gulp": "^3.9.0",
"gulp-batch": "^1.0.5",
"gulp-concat": "^2.6.0",
"gulp-if": "^2.0.0",
"gulp-jshint": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-strip-debug": "^1.1.0",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"jshint": "^2.9.1",
"lodash": "^4.2.1",
"minimatch": "^3.0.0",
"sass": "^0.5.0",
"uglifyjs": "^2.4.10",
"underscore": "^1.8.3",
"yuglify": "^0.1.4"
},
"private": true,
"APIMethod": "stub",
"proxyURL": "http://localhost:8000",
"devDependencies": {}
}
Any clue?
Thank you
Rename/remove your package.json file.
Create a new package file by running:
npm init
Option A: Copy the dependencies you need into the newly created package.json.
Option B: Install the packages and use --save to add the packages to the package.json file.
Run npm install to install the dependencies.
just ran into this.
in my case the answer was environment variable NODE_ENV was set to 'production'
I haven't looked it up but when I changed it to something else, it started working.
I was testing this environment variable for something else and didn't realize it had this effect also.
For me it was a bad version value. Changing from 3.0 to 3.0.0 results in proper installation. 3.0 generates a warning, but fails to do the installation (ie it should be an error).
I am not able to run sails js project on my UBUNTU machine i've sails 0.10.5 and the below is the error i am getting
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ sails lift
info: Starting app...
warn: `sails.config.express` is deprecated; use `sails.config.http` instead.
warn: The adapter `sails-disk` appears to be designed for an earlier version of Sails.
warn: (it has a `registerCollection()` method.)
warn: Since you're running Sails v0.10.x, it probably isn't going to work.
warn: To attempt to install the updated version of this adapter, run:
warn: npm install sails-disk#0.10.x
error: There was an error attempting to require("sails-disk")
error: Is this a valid Sails/Waterline adapter? The following error was encountered ::
error: Adapter is not compatible with the current version of Sails.
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$
my package.json file is:
{
"name": "",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"dependencies": {
"MD5": "1.2.1",
"autocomplete": "0.0.1",
"convert-json": "^0.4.0",
"cron": "^1.0.5",
"download": "^0.1.18",
"ejs": "0.8.4",
"emailjs": "^0.3.8",
"express": "^4.9.8",
"grunt": "0.4.1",
"ipv6": "^3.1.1",
"js-combinatorics": "^0.4.0",
"mkdirp": "^0.5.0",
"moment": "^2.9.0",
"mysql": "2.2.0",
"nodemailer": "0.6.3",
"optimist": "0.3.4",
"pagination": "^0.4.3",
"payment-paypal-payflowpro": "0.0.4",
"paynode": "^0.3.6",
"paypal-rest-sdk": "^1.0.0",
"pdfkit": "0.6.2",
"request": "2.34.0",
"request-json": "0.4.10",
"sails": "0.9.13",
"sails-disk": "~0.9.0",
"sequelize": "1.7.3",
"wkhtmltopdf": "^0.1.4",
"xlsjs": "^0.7.1"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"main": "app.js",
"repository": "",
"author": "",
"license": ""
}
i don't know what is happening and I've already burned penalty of hours doing R&D and fixing it
please help me get rid of this.
Sails and Node versions are:
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ sails --version
0.10.5
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ node --version
v0.10.35
Thanks
Your sails version is 0.10.5 but the sails-disk version specified in your package.json is "sails-disk": "~0.9.0",.
You should update your sails-disk to the latest version. Here's how:
In package.json:
Change "sails-disk": "~0.9.0", to "sails-disk": "*",. Save the file.
Now, run npm update --save.
This will update your sails-disk (probably to "sails-disk": "~0.10.0",) and also set that version in package.json.
Now try sails lift. Good luck !
PS. You should do the same for sails as that version is also not in sync with the installed version.
Update the version of sails-disk
For the version Sails 1 , "sails-disk": "^1.0.1" works.
npm remove --save sails-disk
npm install --save sails-disk