Related
I'm working on a MERN stack app with Babel on the server side of things so that I can write ES6. I'm getting an error when I try to deploy to Heroku: "Unexpected reserved word 'package'"
My Heroku-related scripts:
{
"build": "babel . -d build --ignore ./client,node_modules",
"heroku-postbuild": "YARN_PRODUCTION=false yarn build && yarn --cwd client install && yarn --cwd client build"
}
Full error message:
remote: SyntaxError: /tmp/build_92b72922d4bd2872f60dec7f1e038c5d/.heroku/node/lib/node_modules/npm/node_modules/init-package-json/default-input.js: Unexpected reserved word 'package' (48:11)
remote:
remote: 46 | }}
remote: 47 |
remote: > 48 | var name = package.name || basename
remote: | ^
remote: 49 | var spec
remote: 50 | try {
remote: 51 | spec = npa(name)
remote: at Object._raise (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:757:17)
remote: at Object.raiseWithData (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:750:17)
remote: at Object.raise (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:744:17)
remote: at Object.checkReservedWord (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:10916:14)
remote: at Object.parseIdentifierName (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:10876:12)
remote: at Object.parseIdentifier (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:10847:23)
remote: at Object.parseExprAtom (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:9958:27)
remote: at Object.parseExprAtom (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:4648:20)
remote: at Object.parseExprSubscripts (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:9688:23)
remote: at Object.parseMaybeUnary (/tmp/build_92b72922d4bd2872f60dec7f1e038c5d/node_modules/#babel/parser/lib/index.js:9668:21) {
remote: loc: Position { line: 48, column: 11 },
remote: pos: 1484,
remote: code: 'BABEL_PARSE_ERROR'
remote: }
Couple of things to note:
I had to add node_modules to Babel ignore (I'm not sure whether this is a good idea though) because it was giving me an Unexpected token error:
import * as $protobuf from $DEPENDENCY;` // On the `$` of "$DEPENDENCY"
I assumed I didn't want to transpile the client folder because React has its own build script (default one)
My babel config:
module.exports = {
presets: ["#babel/preset-env", "#babel/preset-react"],
plugins: ["#babel/plugin-proposal-class-properties"]
};
My folder structure:
Found a fix:
I just had to put every server related files/folder into its own directory and update the babel transpilation script as needed
I am deploying node js application on heroku server. I am using webpack for es6 syntax and its working fine everything on my local.
But when I am trying to deploy code on heroku it gives BABEL_PARSE_ERROR.
remote: > taleem-backend#1.0.0 build /tmp/build_dbe1f098c9b56734350ccb6e4f4c0166
remote: > rimraf dist/ && babel ./ --out-dir dist
remote:
remote: SyntaxError: /tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/.heroku/node/lib/node_modules/npm/docs/gatsby-browser.js: Unexpected token (7:9)
remote:
remote: 5 |
remote: 6 | export const wrapPageElement = ({ element, props }) => {
remote: > 7 | return <Layout {...props} >{element}</Layout>
remote: | ^
remote: 8 | }
remote: 9 |
remote: at Parser.raise (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:7017:17)
remote: at Parser.unexpected (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:8395:16)
remote: at Parser.parseExprAtom (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9673:20)
remote: at Parser.parseExprSubscripts (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9259:23)
remote: at Parser.parseMaybeUnary (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9239:21)
remote: at Parser.parseExprOps (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9109:23)
remote: at Parser.parseMaybeConditional (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9082:23)
remote: at Parser.parseMaybeAssign (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:9037:21)
remote: at Parser.parseExpression (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:8989:23)
remote: at Parser.parseReturnStatement (/tmp/build_dbe1f098c9b56734350ccb6e4f4c0166/node_modules/#babel/parser/lib/index.js:11057:28) {
remote: pos: 209,
remote: loc: Position { line: 7, column: 9 },
remote: code: 'BABEL_PARSE_ERROR'
remote: }
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! taleem-backend#1.0.0 build: `rimraf dist/ && babel ./ --out-dir dist`
remote: npm ERR! Exit status 1
Above error is coming in node_modules, but I am already ignoring my node_modules in webpack.config.js and I double check its working fine in my local (ignore logic)
heroku local web
I run above command as its mentioned in heroku docs and
its also working fine
https://devcenter.heroku.com/articles/deploying-nodejs
But when I run
git push heroku master
I got above error. Kindly help me on this to fix this issue.
Thanks
EDIT
webpack.config.js
module.exports = (api) => {
api.cache(true)
return {
ignore: [
"babel.config.js",
"dist",
"package.json",
"node_modules",
'.babelrc'
]
}
}
package.json
"scripts": {
"start": "npm run build && node dist/bin/www",
"build": "rimraf dist/ && babel ./ --out-dir dist",
"watch:dev": "nodemon"
},
Now I fixed that by updating app structure
"build": "rimraf dist/ && babel app/ --out-dir dist",
I want to give a shot at angular 2 so I'm working to install angular2 cli now, but when I install it and then run ng new newapp , it awkwardly opens the command line and says something about 'mg' (not even 'ng').
Here's what happens when I run 'ng new myapp'
I'm running sudo npm install -g angular-cli#latest which gives the following output:
npm WARN engine angular-cli#1.0.0-beta.19-3: wanted: {"node":">= 4.1.0","npm":">= 3.0.0"} (current: {"node":"4.6.1","npm":"2.15.9"})
npm WARN engine #ngtools/webpack#1.1.4: wanted: {"node":">= 4.1.0","npm":">= 3.0.0"} (current: {"node":"4.6.1","npm":"2.15.9"})
npm WARN engine #angular-cli/ast-tools#1.0.7: wanted: {"node":">= 4.1.0","npm":">= 3.0.0"} (current: {"node":"4.6.1","npm":"2.15.9"})
npm WARN optional dep failed, continuing fsevents#1.0.15
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
> execSync#1.0.2 install /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/angular2-template-loader/node_modules/codecov/node_modules/execSync
> node install.js
[execsync v1.0.2] Attempting to compile native extensions.
[execSync v1.0.2]
Native code compile failed!!
npm WARN deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
> node-zopfli#2.0.1 install /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/compression-webpack-plugin/node_modules/node-zopfli
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.1-node-v46-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for node-zopfli#2.0.1 and node#4.6.1 (node-v46 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/compression-webpack-plugin/node_modules/node-zopfli/build'
CXX(target) Release/obj.target/zopfli/src/zopfli-binding.o
CXX(target) Release/obj.target/zopfli/src/png/zopflipng.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/blocksplitter.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/cache.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/deflate.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/gzip_container.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/hash.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/katajainen.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/lz77.o
In file included from ../zopfli/src/zopfli/lz77.c:21:0:
../zopfli/src/zopfli/symbols.h:38:12: warning: ‘ZopfliGetDistExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetDistExtraBits(int dist) {
^
../zopfli/src/zopfli/symbols.h:61:12: warning: ‘ZopfliGetDistExtraBitsValue’ defined but not used [-Wunused-function]
static int ZopfliGetDistExtraBitsValue(int dist) {
^
../zopfli/src/zopfli/symbols.h:138:12: warning: ‘ZopfliGetLengthExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetLengthExtraBits(int l) {
^
../zopfli/src/zopfli/symbols.h:161:12: warning: ‘ZopfliGetLengthExtraBitsValue’ defined but not used [-Wunused-function]
static int ZopfliGetLengthExtraBitsValue(int l) {
^
../zopfli/src/zopfli/symbols.h:222:12: warning: ‘ZopfliGetLengthSymbolExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetLengthSymbolExtraBits(int s) {
^
../zopfli/src/zopfli/symbols.h:231:12: warning: ‘ZopfliGetDistSymbolExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetDistSymbolExtraBits(int s) {
^
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/squeeze.o
In file included from ../zopfli/src/zopfli/squeeze.c:28:0:
../zopfli/src/zopfli/symbols.h:61:12: warning: ‘ZopfliGetDistExtraBitsValue’ defined but not used [-Wunused-function]
static int ZopfliGetDistExtraBitsValue(int dist) {
^
../zopfli/src/zopfli/symbols.h:161:12: warning: ‘ZopfliGetLengthExtraBitsValue’ defined but not used [-Wunused-function]
static int ZopfliGetLengthExtraBitsValue(int l) {
^
../zopfli/src/zopfli/symbols.h:222:12: warning: ‘ZopfliGetLengthSymbolExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetLengthSymbolExtraBits(int s) {
^
../zopfli/src/zopfli/symbols.h:231:12: warning: ‘ZopfliGetDistSymbolExtraBits’ defined but not used [-Wunused-function]
static int ZopfliGetDistSymbolExtraBits(int s) {
^
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/tree.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/util.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/zlib_container.o
CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/zopfli_lib.o
CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/zopflipng_lib.o
CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/lodepng/lodepng.o
CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/lodepng/lodepng_util.o
SOLINK_MODULE(target) Release/obj.target/zopfli.node
COPY Release/zopfli.node
COPY /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/compression-webpack-plugin/node_modules/node-zopfli/lib/binding/node-v46-linux-x64/zopfli.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/compression-webpack-plugin/node_modules/node-zopfli/build'
npm WARN optional dep failed, continuing fsevents#1.0.15
npm WARN deprecated lodash-node#2.4.1: This package is discontinued. Use lodash#^4.0.0.
|
> node-sass#3.11.2 install /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/node-sass
> node scripts/install.js
Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.11.2/linux-x64-46_binding.node
Binary downloaded and installed at /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/node-sass/vendor/linux-x64-46/binding.node
> node-sass#3.11.2 postinstall /home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/node-sass
> node scripts/build.js
"/home/user/.npm-packages/lib/node_modules/angular-cli/node_modules/node-sass/vendor/linux-x64-46/binding.node" exists.
testing binary.
Binary is fine; exiting.
/home/user/.npm-packages/bin/ng -> /home/user/.npm-packages/lib/node_modules/angular-cli/bin/ng
angular-cli#1.0.0-beta.19-3 /home/user/.npm-packages/lib/node_modules/angular-cli
├── ember-cli-string-utils#1.0.0
├── json-loader#0.5.4
├── raw-loader#0.5.1
├── expose-loader#0.7.1
├── script-loader#0.7.0
├── symlink-or-copy#1.1.6
├── fs.realpath#1.0.0
├── rimraf#2.5.4
├── #angular-cli/base-href-webpack#1.0.6
├── denodeify#1.2.1
├── exit#0.1.2
├── karma-sourcemap-loader#0.3.7 (graceful-fs#4.1.10)
├── #ngtools/webpack#1.1.4
├── parse5#2.2.3
├── chalk#1.1.3 (escape-string-regexp#1.0.5, ansi-styles#2.2.1, supports-color#2.0.0, strip-ansi#3.0.1, has-ansi#2.0.0)
├── file-loader#0.8.5 (loader-utils#0.2.16)
├── url-loader#0.5.7 (mime#1.2.11, loader-utils#0.2.16)
├── opn#4.0.1 (object-assign#4.1.0, pinkie-promise#2.0.1)
├── style-loader#0.13.1 (loader-utils#0.2.16)
├── sass-loader#3.2.3 (object-assign#4.1.0, async#1.5.2, loader-utils#0.2.16)
├── silent-error#1.0.1 (debug#2.2.0)
├── zone.js#0.6.26
├── #angular/platform-server#2.1.2
├── fs-extra#0.30.0 (path-is-absolute#1.0.1, klaw#1.3.1, graceful-fs#4.1.10, jsonfile#2.4.0)
├── glob#7.1.1 (path-is-absolute#1.0.1, inherits#2.0.3, inflight#1.0.6, once#1.4.0, minimatch#3.0.3)
├── ts-loader#0.8.2 (object-assign#2.1.1, arrify#1.0.1, semver#5.3.0, colors#1.1.2, loader-utils#0.2.16, enhanced-resolve#0.9.1)
├── tslint-loader#2.1.5 (object-assign#4.1.0, strip-json-comments#1.0.4, loader-utils#0.2.16, mkdirp#0.5.1)
├── stylus-loader#2.3.1 (loader-utils#0.2.16, when#3.6.4)
├── shelljs#0.7.5 (interpret#1.0.1, rechoir#0.6.2)
├── less-loader#2.2.3 (loader-utils#0.2.16)
├── webpack-merge#0.14.1 (lodash.isequal#4.4.0, lodash.merge#3.3.2, lodash.isplainobject#3.2.0, lodash.find#3.2.1)
├── resolve#1.1.7
├── source-map-loader#0.1.5 (async#0.9.2, loader-utils#0.2.16, source-map#0.1.43)
├── exports-loader#0.6.3 (loader-utils#0.2.16, source-map#0.1.43)
├── webpack-md5-hash#0.0.5 (md5#2.2.1)
├── offline-plugin#3.4.2 (deep-extend#0.4.1, loader-utils#0.2.16, es6-promise#3.3.1, minimatch#3.0.3, ejs#2.5.2)
├── enhanced-resolve#2.3.0 (object-assign#4.1.0, graceful-fs#4.1.10, tapable#0.2.4, memory-fs#0.3.0)
├── postcss-loader#0.9.1 (loader-utils#0.2.16, postcss#5.2.5)
├── #angular/compiler-cli#2.1.2 (minimist#1.2.0, reflect-metadata#0.1.8)
├── npm-run-all#3.1.1 (object-assign#4.1.0, pinkie-promise#2.0.1, read-pkg-up#1.0.1, shell-quote#1.6.1, minimatch#3.0.3, cross-spawn#4.0.2, ps-tree#1.1.0, read-pkg#1.1.0, string.prototype.padend#3.0.0)
├── #angular/common#2.1.2
├── #angular/platform-browser#2.1.2
├── leek#0.0.21 (debug#2.2.0, lodash.assign#3.2.0, rsvp#3.3.3, request#2.78.0)
├── sourcemap-istanbul-instrumenter-loader#0.2.0 (object-assign#4.1.0, loader-utils#0.2.16, istanbul#0.4.5)
├── istanbul-instrumenter-loader#0.2.0 (object-assign#4.1.0, loader-utils#0.2.16, istanbul#0.4.5)
├── webpack-dev-server#2.1.0-beta.9 (connect-history-api-fallback#1.3.0, strip-ansi#3.0.1, supports-color#3.1.2, opn#4.0.2, compression#1.6.2, express#4.14.0, webpack-dev-middleware#1.8.4, spdy#3.4.4, http-proxy-middleware#0.17.2, chokidar#1.6.1, sockjs#0.3.18, serve-index#1.8.0, sockjs-client#1.1.1, yargs#4.8.1)
├── angular2-template-loader#0.5.0 (loader-utils#0.2.16, codecov#1.0.1)
├── stylus#0.54.5 (css-parse#1.7.0, debug#2.2.0, mkdirp#0.5.1, glob#7.0.6, source-map#0.1.43, sax#0.5.8)
├── html-webpack-plugin#2.24.1 (toposort#1.0.0, loader-utils#0.2.16, bluebird#3.4.6, html-minifier#3.1.0, pretty-error#2.0.2)
├── handlebars#4.0.5 (async#1.5.2, source-map#0.4.4, optimist#0.6.1, uglify-js#2.7.4)
├── typescript#2.0.7
├── common-tags#1.3.1 (babel-runtime#6.18.0)
├── awesome-typescript-loader#2.2.4 (object-assign#4.1.0, colors#1.1.2, loader-utils#0.2.16, source-map-support#0.4.6)
├── remap-istanbul#0.6.4 (amdefine#1.0.0, source-map#0.5.6, through2#2.0.1, gulp-util#3.0.7, istanbul#0.4.3)
├── #angular/tsc-wrapped#0.3.0 (tsickle#0.1.7)
├── compression-webpack-plugin#0.3.2 (async#0.2.10, webpack-sources#0.1.2, node-zopfli#2.0.1)
├── tslint#3.15.1 (colors#1.1.2, diff#2.2.3, optimist#0.6.1, findup-sync#0.3.0, underscore.string#3.3.4)
├── #angular/core#2.1.2
├── #angular/compiler#2.1.2
├── string-replace-loader#1.0.5 (loader-utils#0.2.16, lodash#3.10.1)
├── webpack#2.1.0-beta.25 (object-assign#4.1.0, interpret#1.0.1, tapable#0.2.4, async#1.5.2, clone#1.0.2, supports-color#3.1.2, loader-utils#0.2.16, loader-runner#2.2.0, source-map#0.5.6, mkdirp#0.5.1, acorn#3.3.0, memory-fs#0.3.0, webpack-sources#0.1.2, uglify-js#2.7.4, watchpack#1.1.0, ajv#4.8.2, yargs#4.8.1, node-libs-browser#1.0.0)
├── karma-webpack#1.8.0 (async#0.9.2, loader-utils#0.2.16, source-map#0.1.43, webpack-dev-middleware#1.8.4, lodash#3.10.1)
├── protractor#3.3.0 (jasminewd2#0.0.9, q#1.4.1, adm-zip#0.4.7, source-map-support#0.4.6, glob#6.0.4, optimist#0.6.1, saucelabs#1.0.1, jasmine#2.4.1, request#2.67.0, selenium-webdriver#2.52.0)
├── typedoc#0.4.5 (progress#1.1.8, marked#0.3.6, minimatch#3.0.3, typedoc-default-themes#0.4.0, typescript#1.8.10, highlight.js#9.8.0)
├── css-loader#0.23.1 (postcss-modules-extract-imports#1.0.1, object-assign#4.1.0, loader-utils#0.2.16, postcss-modules-values#1.2.2, css-selector-tokenizer#0.5.4, source-list-map#0.1.6, lodash.camelcase#3.0.1, postcss-modules-scope#1.0.2, postcss-modules-local-by-default#1.1.1, postcss#5.2.5, cssnano#3.8.0)
├── less#2.7.1 (graceful-fs#4.1.10, mime#1.3.4, image-size#0.5.0, source-map#0.5.6, errno#0.1.4, mkdirp#0.5.1, promise#7.1.1)
├── lodash#4.16.6
├── core-js#2.4.1
├── rxjs#5.0.0-beta.12 (symbol-observable#1.0.4)
├── #angular-cli/ast-tools#1.0.7 (rxjs#5.0.0-beta.11)
├── node-sass#3.11.2 (get-stdin#4.0.1, lodash.assign#4.2.0, lodash.clonedeep#4.5.0, async-foreach#0.1.3, in-publish#2.0.0, nan#2.4.0, mkdirp#0.5.1, cross-spawn#3.0.1, gaze#1.1.2, npmlog#4.0.0, meow#3.7.0, request#2.78.0, sass-graph#2.1.2, node-gyp#3.4.0)
└── ember-cli#2.5.0 (ember-cli-test-info#1.0.0, ember-cli-path-utils#1.0.0, ember-cli-is-package-missing#1.0.0, clean-base-url#1.0.0, ember-cli-normalize-entity-name#1.0.0, get-caller-file#1.0.2, fs-monitor-stack#1.1.1, git-repo-info#1.3.1, broccoli-funnel-reducer#1.0.0, ember-cli-valid-component-name#1.0.0, ember-cli-get-component-path-option#1.0.0, is-git-url#0.2.3, escape-string-regexp#1.0.5, promise-map-series#0.2.3, isbinaryfile#2.0.4, broccoli-plugin#1.2.2, broccoli-source#1.1.0, exists-sync#0.0.3, semver#5.3.0, filesize#3.3.0, inflection#1.10.0, bower-endpoint-parser#0.2.2, broccoli-viz#2.0.1, node-modules-path#1.0.1, through#2.3.8, amd-name-resolver#0.0.5, broccoli-sane-watcher#1.1.5, walk-sync#0.2.7, node-uuid#1.4.7, portfinder#1.0.9, nopt#3.0.6, debug#2.2.0, http-proxy#1.15.2, minimatch#3.0.3, readline2#0.1.1, diff#2.2.3, temp#0.8.3, findup#0.1.5, morgan#1.7.0, glob#7.0.3, configstore#2.1.0, fs-tree-diff#0.4.4, broccoli-funnel#1.0.9, rsvp#3.3.3, merge-defaults#0.2.1, ora#0.2.3, mkdirp#0.5.1, broccoli-kitchen-sink-helpers#0.3.1, quick-temp#0.1.5, fs-extra#0.26.7, compression#1.6.2, sane#1.4.1, findup-sync#0.2.1, express#4.14.0, broccoli-config-replace#1.1.2, inquirer#0.12.0, cpr#0.4.2, tree-sync#1.1.4, broccoli-merge-trees#1.1.4, yam#0.0.18, ember-router-generator#1.2.2, ember-cli-broccoli#0.16.9, broccoli-config-loader#1.0.0, tiny-lr#0.2.1, broccoli-concat#2.3.8, markdown-it#4.3.0, markdown-it-terminal#0.0.3, testem#1.13.0, ember-cli-preprocess-registry#2.0.0, core-object#0.0.2, bower-config#1.4.0, broccoli-babel-transpiler#5.6.1, bower#1.7.9, npm#2.14.21)
Trying to debug it, I tried the minimatch installaton by running sudo npm install -g minimatch#3.0.2, which gives me this output.
minimatch#3.0.2 /home/user/.npm-packages/lib/node_modules/minimatch
└── brace-expansion#1.1.6 (balanced-match#0.4.2, concat-map#0.0.1)
But when I do npm minimatch -v it gives me this 2.15.9
Any suggestions?
It should be npm install #angular/cli -g not angular/cli. I also recommended not using '#latest'. Uninstall all with: npm uninstall angular/cli then run npm install -g #angular/cli. Should work for you.
I installed the mean stack using npm install -g mean-cli command without any errors. But when I want to start a mean project with mean init myApp I have -bash: mean: command not found. It seems to be easy to fix but so far I couldn't find the solution and it's blocking me since yesterday. Did anyone had the similar problem?
Thanks
EDIT
Here are installation logs :
mean-cli#0.10.12 preinstall /Users/magrytos/.node/lib/node_modules/mean-cli
node ./scripts/preinstall
npm WARN deprecated json-file-plus#2.0.0: Before v3.0.0, errors in fs.writeFile would not be propagated
mean-health#0.1.7 postinstall /Users/magrytos/.node/lib/node_modules/mean-cli/node_modules/mean-health
node ./postinstall.js
kerberos#0.0.11 install /Users/magrytos/.node/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
(node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
SOLINK_MODULE(target) Release/kerberos.node: Finished
bson-ext#0.1.7 install /Users/magrytos/.node/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/bson/node_modules/bson-ext
(node-pre-gyp install --fallback-to-build) || (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
/Users/magrytos/.node/bin/mean -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean
/Users/magrytos/.node/bin/mean-init -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-init
/Users/magrytos/.node/bin/mean-authorize -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-authorize
/Users/magrytos/.node/bin/mean-login -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-login
/Users/magrytos/.node/bin/mean-addKey -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-addKey
/Users/magrytos/.node/bin/mean-publish -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-publish
/Users/magrytos/.node/bin/mean-whoami -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-whoami
/Users/magrytos/.node/bin/mean-register -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-register
/Users/magrytos/.node/bin/mean-postinstall -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-postinstall
/Users/magrytos/.node/bin/mean-preinstall -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-preinstall
/Users/magrytos/.node/bin/mean-install -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-install
/Users/magrytos/.node/bin/mean-deploy -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-deploy
/Users/magrytos/.node/bin/mean-search -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-search
/Users/magrytos/.node/bin/mean-uninstall -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-uninstall
/Users/magrytos/.node/bin/mean-logs -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-logs
/Users/magrytos/.node/bin/mean-docs -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-docs
/Users/magrytos/.node/bin/mean-package -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-package
/Users/magrytos/.node/bin/mean-status -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-status
/Users/magrytos/.node/bin/mean-user -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-user
/Users/magrytos/.node/bin/mean-list -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-list
/Users/magrytos/.node/bin/mean-logout -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-logout
/Users/magrytos/.node/bin/mean-enable -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-enable
/Users/magrytos/.node/bin/mean-disable -> /Users/magrytos/.node/lib/node_modules/mean-cli/bin/mean-disable
mean-cli#0.10.12 /Users/magrytos/.node/lib/node_modules/mean-cli
├── opener#1.4.1
├── async-series#0.0.1
├── progress#1.1.8
├── crypto#0.0.3
├── shelljs#0.3.0
├── commander#2.8.1 (graceful-readlink#1.0.1)
├── chalk#0.5.1 (ansi-styles#1.1.0, escape-string-regexp#1.0.3, supports-color#0.2.0, has-ansi#0.1.0, strip-ansi#0.3.0)
├── lodash#2.4.2
├── mean-health#0.1.7
├── npm#2.10.0
├── json-file-plus#2.0.0 (is#2.0.2, node.extend#1.1.3, promiseback#2.0.1)
├── prompt#0.2.14 (revalidator#0.1.8, pkginfo#0.3.0, read#1.0.6, winston#0.8.3, utile#0.2.1)
├── request#2.55.0 (caseless#0.9.0, aws-sign2#0.5.0, forever-agent#0.6.1, stringstream#0.0.4, oauth-sign#0.6.0, tunnel-agent#0.4.0, isstream#0.1.2, json-stringify-safe#5.0.1, node-uuid#1.4.3, qs#2.4.2, tough-cookie#1.1.0, form-data#0.2.0, combined-stream#0.0.7, http-signature#0.10.1, mime-types#2.0.12, hawk#2.3.1, bl#0.9.4, har-validator#1.7.0)
├── inquirer#0.8.4 (figures#1.3.5, ansi-regex#1.1.1, cli-width#1.0.1, through#2.3.7, readline2#0.1.1, chalk#1.0.0, lodash#3.9.1, rx#2.5.2)
├── bower#1.4.1 (is-root#1.0.0, junk#1.0.1, stringify-object#1.0.1, user-home#1.1.1, abbrev#1.0.5, chmodr#0.1.0, rimraf#2.3.4, archy#1.0.0, opn#1.0.2, bower-logger#0.2.2, bower-endpoint-parser#0.2.2, graceful-fs#3.0.7, lru-cache#2.6.4, lockfile#1.0.1, nopt#3.0.2, retry#0.6.1, tmp#0.0.24, q#1.4.1, chalk#1.0.0, request-progress#0.3.1, semver#2.3.2, promptly#0.2.0, fstream#1.0.6, mkdirp#0.5.0, shell-quote#1.4.3, p-throttler#0.1.1, bower-json#0.4.0, which#1.1.1, glob#4.5.3, fstream-ignore#1.0.2, tar-fs#1.5.1, insight#0.5.3, decompress-zip#0.1.0, request#2.53.0, update-notifier#0.3.2, github#0.2.4, bower-registry-client#0.3.0, cardinal#0.4.4, mout#0.11.0, bower-config#0.6.1, configstore#0.3.2, inquirer#0.8.0, handlebars#2.0.0)
└── mongoose#4.0.3 (regexp-clone#0.0.1, sliced#0.0.5, muri#1.0.0, hooks-fixed#1.0.1, mpromise#0.5.4, kareem#1.0.1, mpath#0.1.1, async#0.9.0, ms#0.1.0, mquery#1.5.1, mongodb#2.0.30, bson#0.3.2)
You need to add the npm modules directory to your path. See this answer: https://stackoverflow.com/a/16635816/78496
I'm following this guide
http://mobileangularui.com/blog/your-first-phonegap-app-with-mobile-angular-ui/#why-not-just-twitter-bootstrap-and-angular-ui-
but when i run this code
npm install -g bower yo gulp generator-mobileangularui
I receive this error...
C:\Users\Desktop\Sorgente\weather>npm install -g bower yo gulp
generator-mobileangularui
> npm WARN engine yo#1.4.6: wanted: {"node":">=0.10.0","npm":">=2.1.0"}
(current:
{"node":"v0.10.29","npm":"1.4.14"})
|
> buffertools#2.1.2 install C:\Users\AppData\Roaming\npm\node_m
odules\generator-mobileangularui\node_modules\slug\node_modules\unicode\node_mod
ules\bufferstream\node_modules\buffertools
> node-gyp rebuild
C:\Users\AppData\Roaming\npm\node_modules\generator-mobileangul
arui\node_modules\slug\node_modules\unicode\node_modules\bufferstream\node_modul
es\buffertools>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\
..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua
l Studio 2005 or 3) add the location of the component to the system path if it
is installed elsewhere. [C:\Users\AppData\Roaming\npm\node_modules\generator-mobileangularui\node_modules\slug\n
ode_modules\unicode\node_modules\bufferstream\node_modules\buffertools\build\bi
nding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\AppData\Roaming\npm\node_modules\generato
r-mobileangularui\node_modules\slug\node_modules\unicode\node_modules\bufferstre
am\node_modules\buffertools
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm WARN optional dep failed, continuing buffertools#2.1.2
|
> unicode#0.6.1 postinstall C:\Users\AppData\Roaming\npm\node_m
odules\generator-mobileangularui\node_modules\slug\node_modules\unicode
> node install.js
try to read file /usr/share/unicode/UnicodeData.txt .
Warning: using slow naiv Buffer.indexOf function!
`npm install buffertools` to speed things up.
/usr/share/unicode/UnicodeData.txt not found.
try to read file /usr/share/unicode-data/UnicodeData.txt .
/usr/share/unicode-data/UnicodeData.txt not found.
try to read file UnicodeData.txt .
UnicodeData.txt not found.
try to download .
GET unicode.org:80/Public/UNIDATA/UnicodeData.txt
fetching .
C:\Users\AppData\Roaming\npm\gulp -> C:\Users\
AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\AppData\Roaming\npm\yo -> C:\Users\Ap
pData\Roaming\npm\node_modules\yo\lib\cli.js
> yo#1.4.6 postinstall C:\Users\AppData\Roaming\npm\node_module
s\yo
> yodoctor
/
Yeoman Doctor
Running sanity checks on your system
V Global configuration file is valid
V NODE_PATH matches the npm root
V No .bowerrc file in home directory
V No .yo-rc.json file in home directory
Everything looks all right!
C:\Users\AppData\Roaming\npm\bower -> C:\Users
\AppData\Roaming\npm\node_modules\bower\bin\bower
gulp#3.8.11 C:\Users\AppData\Roaming\npm\node_modules\gulp
├── interpret#0.3.10
├── pretty-hrtime#0.2.2
├── deprecated#0.0.1
├── archy#1.0.0
├── tildify#1.0.0 (user-home#1.1.1)
├── minimist#1.1.1
├── v8flags#2.0.5 (user-home#1.1.1)
├── semver#4.3.4
├── chalk#0.5.1 (ansi-styles#1.1.0, supports-color#0.2.0, escape-string-regexp#1
.0.3, has-ansi#0.1.0, strip-ansi#0.3.0)
├── orchestrator#0.3.7 (stream-consume#0.1.0, sequencify#0.0.7, end-of-stream#0.
1.5)
├── liftoff#2.0.3 (extend#2.0.1, flagged-respawn#0.3.1, resolve#1.1.6, findup-sy
nc#0.2.1)
├── vinyl-fs#0.3.13 (graceful-fs#3.0.6, strip-bom#1.0.0, vinyl#0.4.6, defaults#1
.0.2, mkdirp#0.5.0, glob-stream#3.1.18, glob-watcher#0.0.6, through2#0.6.5)
└── gulp-util#3.0.4 (array-uniq#1.0.2, array-differ#1.0.0, beeper#1.0.0, lodash.
_reevaluate#3.0.0, object-assign#2.0.0, lodash._reescape#3.0.0, lodash._reinterp
olate#3.0.0, replace-ext#0.0.1, vinyl#0.4.6, chalk#1.0.0, dateformat#1.0.11, lod
ash.template#3.5.1, through2#0.6.5, multipipe#0.1.2)
generator-mobileangularui#1.2.1 C:\Users\AppData\Roaming\npm\no
de_modules\generator-mobileangularui
├── chalk#0.4.0 (ansi-styles#1.0.0, has-color#0.1.7, strip-ansi#0.1.1)
├── yosay#0.1.0 (pad-component#0.0.1, word-wrap#0.1.3, minimist#0.0.9)
├── slug#0.5.0 (unicode#0.6.1)
└── yeoman-generator#0.16.0 (dargs#0.1.0, diff#1.0.8, debug#0.7.4, isbinaryfile#
2.0.4, class-extend#0.1.1, rimraf#2.2.8, async#0.2.10, findup-sync#0.1.3, mime#1
.2.11, text-table#0.2.0, mkdirp#0.3.5, iconv-lite#0.2.11, shelljs#0.2.6, lodash#
2.4.2, underscore.string#2.3.3, glob#3.2.11, file-utils#0.1.5, request#2.30.0, c
heerio#0.13.1, inquirer#0.4.1, download#0.1.19)
yo#1.4.6 C:\Users\AppData\Roaming\npm\node_modules\yo
├── titleize#1.0.0
├── array-uniq#1.0.2
├── figures#1.3.5
├── user-home#1.1.1
├── humanize-string#1.0.1 (decamelize#1.0.0)
├── opn#1.0.2
├── string-length#1.0.0 (strip-ansi#2.0.1)
├── async#0.9.0
├── sort-on#1.2.0 (dot-prop#2.0.0)
├── yeoman-character#1.0.1 (supports-color#1.3.1)
├── cross-spawn#0.2.9 (lru-cache#2.6.2)
├── findup#0.1.5 (commander#2.1.0, colors#0.6.2)
├── root-check#1.0.0 (downgrade-root#1.1.0, sudo-block#1.2.0)
├── yosay#1.0.3 (ansi-styles#2.0.1, word-wrap#1.0.3, ansi-regex#1.1.1, strip-ans
i#2.0.1, pad-component#0.0.1, taketalk#1.0.0, minimist#1.1.1)
├── chalk#1.0.0 (escape-string-regexp#1.0.3, ansi-styles#2.0.1, supports-color#1
.3.1, strip-ansi#2.0.1, has-ansi#1.0.3)
├── meow#3.1.0 (object-assign#2.0.0, camelcase-keys#1.0.0, indent-string#1.2.1,
minimist#1.1.1)
├── update-notifier#0.3.2 (is-npm#1.0.0, latest-version#1.0.0, semver-diff#2.0.0
)
├── npm-keyword#1.1.1 (registry-url#3.0.3)
├── package-json#1.1.0 (registry-url#3.0.3)
├── got#2.9.2 (lowercase-keys#1.0.0, is-stream#1.0.1, timed-out#2.0.0, prepend-h
ttp#1.0.1, nested-error-stacks#1.0.0, infinity-agent#2.0.3, statuses#1.2.1, obje
ct-assign#2.0.0, read-all-stream#2.1.2, duplexify#3.3.0)
├── fullname#1.1.0 (npmconf#2.1.1)
├── configstore#0.3.2 (xdg-basedir#1.0.1, object-assign#2.0.0, osenv#0.1.0, grac
eful-fs#3.0.6, uuid#2.0.1, mkdirp#0.5.0, js-yaml#3.3.0)
├── insight#0.5.3 (object-assign#2.0.0, lodash.debounce#3.0.3, tough-cookie#0.12
.1, os-name#1.0.3, request#2.55.0)
├── yeoman-doctor#1.3.2 (object-values#1.0.0, log-symbols#1.0.2, each-async#1.1.
1, twig#0.7.2)
├── yeoman-environment#1.2.5 (untildify#2.0.0, log-symbols#1.0.2, escape-string-
regexp#1.0.3, diff#1.4.0, text-table#0.2.0, debug#2.1.3, grouped-queue#0.3.0, gl
obby#1.2.0, mem-fs#1.1.0)
├── lodash#3.8.0
└── inquirer#0.8.3 (cli-width#1.0.1, ansi-regex#1.1.1, through#2.3.7, readline2#
0.1.1, rx#2.5.2)
bower#1.4.1 C:\Users\AppData\Roaming\npm\node_modules\bower
├── is-root#1.0.0
├── junk#1.0.1
├── stringify-object#1.0.1
├── chmodr#0.1.0
├── which#1.0.9
├── abbrev#1.0.5
├── rimraf#2.3.3
├── user-home#1.1.1
├── lockfile#1.0.0
├── opn#1.0.2
├── bower-logger#0.2.2
├── bower-endpoint-parser#0.2.2
├── graceful-fs#3.0.6
├── archy#1.0.0
├── nopt#3.0.1
├── retry#0.6.1
├── lru-cache#2.6.2
├── semver#2.3.2
├── p-throttler#0.1.1 (q#0.9.7)
├── tmp#0.0.24
├── request-progress#0.3.1 (throttleit#0.0.2)
├── q#1.3.0
├── shell-quote#1.4.3 (array-filter#0.0.1, array-reduce#0.0.0, array-map#0.0.0,
jsonify#0.0.0)
├── chalk#1.0.0 (escape-string-regexp#1.0.3, ansi-styles#2.0.1, supports-color#1
.3.1, strip-ansi#2.0.1, has-ansi#1.0.3)
├── mkdirp#0.5.0 (minimist#0.0.8)
├── promptly#0.2.0 (read#1.0.5)
├── bower-json#0.4.0 (intersect#0.0.3, deep-extend#0.2.11, graceful-fs#2.0.3)
├── insight#0.5.3 (object-assign#2.0.0, lodash.debounce#3.0.3, async#0.9.0, toug
h-cookie#0.12.1, os-name#1.0.3)
├── glob#4.5.3 (once#1.3.2, inflight#1.0.4, inherits#2.0.1, minimatch#2.0.7)
├── fstream#1.0.5 (inherits#2.0.1)
├── fstream-ignore#1.0.2 (inherits#2.0.1, minimatch#2.0.7)
├── cardinal#0.4.4 (ansicolors#0.2.1, redeyed#0.4.4)
├── decompress-zip#0.1.0 (mkpath#0.1.0, touch#0.0.3, binary#0.3.0, readable-stre
am#1.1.13)
├── tar-fs#1.5.0 (pump#1.0.0, tar-stream#1.1.4)
├── github#0.2.4 (mime#1.3.4)
├── request#2.53.0 (caseless#0.9.0, forever-agent#0.5.2, aws-sign2#0.5.0, tunnel
-agent#0.4.0, oauth-sign#0.6.0, json-stringify-safe#5.0.0, isstream#0.1.2, strin
gstream#0.0.4, qs#2.3.3, node-uuid#1.4.3, combined-stream#0.0.7, mime-types#2.0.
11, form-data#0.2.0, http-signature#0.10.1, hawk#2.3.1, tough-cookie#1.1.0, bl#0
.9.4)
├── update-notifier#0.3.2 (is-npm#1.0.0, string-length#1.0.0, semver-diff#2.0.0,
latest-version#1.0.0)
├── bower-registry-client#0.3.0 (rimraf#2.2.8, request-replay#0.2.0, graceful-fs
#2.0.3, lru-cache#2.3.1, mkdirp#0.3.5, async#0.2.10, request#2.51.0)
├── mout#0.11.0
├── handlebars#2.0.0 (optimist#0.3.7, uglify-js#2.3.6)
├── bower-config#0.6.1 (osenv#0.0.3, graceful-fs#2.0.3, optimist#0.6.1, mout#0.9
.1)
├── configstore#0.3.2 (object-assign#2.0.0, xdg-basedir#1.0.1, osenv#0.1.0, uuid
#2.0.1, js-yaml#3.3.0)
└── inquirer#0.8.0 (figures#1.3.5, ansi-regex#1.1.1, mute-stream#0.0.4, through#
2.3.7, readline2#0.1.1, chalk#0.5.1, lodash#2.4.2, rx#2.5.2, cli-color#0.3.3)
C:\Users\Desktop\Sorgente\weather>yo mobileangularui
Error: Cannot find module 'unicode/category/So'
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 symbols (C:\Users\AppData\Roaming\npm\node_modules\gener
ator-mobileangularui\node_modules\slug\slug.js:6:16)
at C:\Users\AppData\Roaming\npm\node_modules\generator-mobi
leangularui\node_modules\slug\slug.js:123:5
at Object.<anonymous> (C:\Users\AppData\Roaming\npm\node_mo
dules\generator-mobileangularui\node_modules\slug\slug.js:130:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
I installed the .NET Framework 2.0 SDK but I have the same problem...How can fix it???
My versions:
C:\Users\bla>npm -v
1.4.14
C:\Users\bla>node -v
v0.10.29
C:\Users\bla>cordova -v
4.3.0
Try running:
node-gyp rebuild --msvs-version=2012
Also works with:
--msvs-version=2013