Grunt build fails if repository folder path contains "/var/" #2450

Closed
patrickording opened this Issue Jul 6, 2015 · 13 comments

Comments

Projects
None yet
5 participants
@patrickording

Hi

I'm trying to build my own custom jQuery but although I strictly followed the instructions in the README I get a "Warning" and when I --force the build process it doesn't work either.

MacBook Pro with:

grunt-cli v0.1.13
grunt v0.4.2
git version 2.4.5
node version v0.12.5

e.g. running

grunt custom:-ajax

results in:

grunt custom:-ajax
Running "custom:-ajax" (custom) task
Creating custom build...

Running "build:all:*:-ajax" (build) task
-ajax
-ajax/jsonp
-ajax/load
-ajax/parseJSON
-ajax/parseXML
-ajax/script
-ajax/var/nonce
-ajax/var/rquery
-ajax/xhr
-manipulation/_evalUrl
-event/ajax
Warning: TypeError: Cannot read property '1' of null
at Object.convert [as onBuildWrite]
jquery/build/tasks/build.js:49:77
Use --force to continue.

I was trying to build a custom version of jquery on a different machine (2015 iMac) and I get the same warning...

Any ideas what I'm doing wrong?
Thanks in advance!

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Jul 6, 2015

Member

Can't reproduce, try rm -rf node_modules && npm i in project root dir. Version of the grunt should be 0.4.5, but even with 0.4.2 it should work. If that doesn't help try update node version to the latest one - 0.12.6. Although it should work on previous ones too

Member

markelog commented Jul 6, 2015

Can't reproduce, try rm -rf node_modules && npm i in project root dir. Version of the grunt should be 0.4.5, but even with 0.4.2 it should work. If that doesn't help try update node version to the latest one - 0.12.6. Although it should work on previous ones too

@patrickording

This comment has been minimized.

Show comment
Hide comment
@patrickording

patrickording Jul 6, 2015

If I run

npm run build

it results in

> jquery@3.0.0-pre build query
> npm install && grunt

Running "build:all:*" (build) task
Warning: TypeError: Cannot read property '1' of null
    at Object.convert [as onBuildWrite] (jquery/build/tasks/build.js:53:77)
 Use --force to continue.

Aborted due to warnings.

npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v0.12.5
npm ERR! npm  v2.12.1
npm ERR! code ELIFECYCLE
npm ERR! jquery@3.0.0-pre build: `npm install && grunt`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the jquery@3.0.0-pre build script 'npm install && grunt'.
npm ERR! This is most likely a problem with the jquery package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm install && grunt
npm ERR! You can get their info via:
npm ERR!     npm owner ls jquery
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@2.12.1
3 info using node@v0.12.5
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
6 info prebuild jquery@3.0.0-pre
7 info build jquery@3.0.0-pre
8 verbose unsafe-perm in lifecycle true
9 info jquery@3.0.0-pre Failed to exec build script
10 verbose stack Error: jquery@3.0.0-pre build: `npm install && grunt`
10 verbose stack Exit status 3
10 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1015:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid jquery@3.0.0-pre
12 verbose cwd /Users/pording/var/www/github-clones/jquery
13 error Darwin 14.3.0
14 error argv "node" "/usr/local/bin/npm" "run" "build"
15 error node v0.12.5
16 error npm  v2.12.1
17 error code ELIFECYCLE
18 error jquery@3.0.0-pre build: `npm install && grunt`
18 error Exit status 3
19 error Failed at the jquery@3.0.0-pre build script 'npm install && grunt'.
19 error This is most likely a problem with the jquery package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     npm install && grunt
19 error You can get their info via:
19 error     npm owner ls jquery
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]

If I run

npm run build

it results in

> jquery@3.0.0-pre build query
> npm install && grunt

Running "build:all:*" (build) task
Warning: TypeError: Cannot read property '1' of null
    at Object.convert [as onBuildWrite] (jquery/build/tasks/build.js:53:77)
 Use --force to continue.

Aborted due to warnings.

npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v0.12.5
npm ERR! npm  v2.12.1
npm ERR! code ELIFECYCLE
npm ERR! jquery@3.0.0-pre build: `npm install && grunt`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the jquery@3.0.0-pre build script 'npm install && grunt'.
npm ERR! This is most likely a problem with the jquery package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm install && grunt
npm ERR! You can get their info via:
npm ERR!     npm owner ls jquery
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@2.12.1
3 info using node@v0.12.5
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
6 info prebuild jquery@3.0.0-pre
7 info build jquery@3.0.0-pre
8 verbose unsafe-perm in lifecycle true
9 info jquery@3.0.0-pre Failed to exec build script
10 verbose stack Error: jquery@3.0.0-pre build: `npm install && grunt`
10 verbose stack Exit status 3
10 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1015:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid jquery@3.0.0-pre
12 verbose cwd /Users/pording/var/www/github-clones/jquery
13 error Darwin 14.3.0
14 error argv "node" "/usr/local/bin/npm" "run" "build"
15 error node v0.12.5
16 error npm  v2.12.1
17 error code ELIFECYCLE
18 error jquery@3.0.0-pre build: `npm install && grunt`
18 error Exit status 3
19 error Failed at the jquery@3.0.0-pre build script 'npm install && grunt'.
19 error This is most likely a problem with the jquery package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     npm install && grunt
19 error You can get their info via:
19 error     npm owner ls jquery
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Jul 6, 2015

Member

@patrickording did you try suggestions above? Also, do you using latest master?

Member

markelog commented Jul 6, 2015

@patrickording did you try suggestions above? Also, do you using latest master?

@patrickording

This comment has been minimized.

Show comment
Hide comment
@patrickording

patrickording Jul 6, 2015

@markelog yes I tried what you suggested but it didn't work. Yes I'm on the latest master!

@markelog yes I tried what you suggested but it didn't work. Yes I'm on the latest master!

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Jul 6, 2015

Member

I cannot reproduce. It seems as if you had some extra files in the jquery folder that are passed through the build task. What does git status say? Can you try with a freshly cloned repository?

Member

mgol commented Jul 6, 2015

I cannot reproduce. It seems as if you had some extra files in the jquery folder that are passed through the build task. What does git status say? Can you try with a freshly cloned repository?

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Jul 6, 2015

Member

You can also edit the build/tasks/build.js file and add:

console.log('path', path);
console.log('name', name);

before line 53. You'll see which file causes an error.

Member

mgol commented Jul 6, 2015

You can also edit the build/tasks/build.js file and add:

console.log('path', path);
console.log('name', name);

before line 53. You'll see which file causes an error.

@patrickording

This comment has been minimized.

Show comment
Hide comment
@patrickording

patrickording Jul 6, 2015

 ✘  ~/var/www/github-clones/jquery   master ●  git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   build/tasks/build.js

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .idea/
    npm-debug.log

@mzgol yes I can try with a freshly cloned repo.

 ✘  ~/var/www/github-clones/jquery   master ●  sudo npm run build

> jquery@3.0.0-pre build /Users/pording/var/www/github-clones/jquery
> npm install && grunt

Running "build:all:*" (build) task
path /Users/pording/var/www/github-clones/jquery/src/var/arr.js
name var/arr
path /Users/pording/var/www/github-clones/jquery/src/var/document.js
name var/document
path /Users/pording/var/www/github-clones/jquery/src/var/slice.js
name var/slice
path /Users/pording/var/www/github-clones/jquery/src/var/concat.js
name var/concat
path /Users/pording/var/www/github-clones/jquery/src/var/push.js
name var/push
path /Users/pording/var/www/github-clones/jquery/src/var/indexOf.js
name var/indexOf
path /Users/pording/var/www/github-clones/jquery/src/var/class2type.js
name var/class2type
path /Users/pording/var/www/github-clones/jquery/src/var/toString.js
name var/toString
path /Users/pording/var/www/github-clones/jquery/src/var/hasOwn.js
name var/hasOwn
path /Users/pording/var/www/github-clones/jquery/src/var/support.js
name var/support
path /Users/pording/var/www/github-clones/jquery/src/core.js
name core
Warning: TypeError: Cannot read property '1' of null
    at Object.convert [as onBuildWrite] (/Users/pording/var/www/github-clones/jquery/build/tasks/build.js:55:77)
 Use --force to continue.
 ✘  ~/var/www/github-clones/jquery   master ●  git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   build/tasks/build.js

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .idea/
    npm-debug.log

@mzgol yes I can try with a freshly cloned repo.

 ✘  ~/var/www/github-clones/jquery   master ●  sudo npm run build

> jquery@3.0.0-pre build /Users/pording/var/www/github-clones/jquery
> npm install && grunt

Running "build:all:*" (build) task
path /Users/pording/var/www/github-clones/jquery/src/var/arr.js
name var/arr
path /Users/pording/var/www/github-clones/jquery/src/var/document.js
name var/document
path /Users/pording/var/www/github-clones/jquery/src/var/slice.js
name var/slice
path /Users/pording/var/www/github-clones/jquery/src/var/concat.js
name var/concat
path /Users/pording/var/www/github-clones/jquery/src/var/push.js
name var/push
path /Users/pording/var/www/github-clones/jquery/src/var/indexOf.js
name var/indexOf
path /Users/pording/var/www/github-clones/jquery/src/var/class2type.js
name var/class2type
path /Users/pording/var/www/github-clones/jquery/src/var/toString.js
name var/toString
path /Users/pording/var/www/github-clones/jquery/src/var/hasOwn.js
name var/hasOwn
path /Users/pording/var/www/github-clones/jquery/src/var/support.js
name var/support
path /Users/pording/var/www/github-clones/jquery/src/core.js
name core
Warning: TypeError: Cannot read property '1' of null
    at Object.convert [as onBuildWrite] (/Users/pording/var/www/github-clones/jquery/build/tasks/build.js:55:77)
 Use --force to continue.
@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Jul 6, 2015

Member

Hah, now it's obvious to me, thanks, @patrickording! So, the build system assumes that any file with /var/ in the path should be treated as variable declaration. Since you put the entire repo inside a such a directory, everything is treated this way which breaks.

This seems like a bug we should fix, we shouldn't be looking at places above the main repository directory. In the meantime, you can move the repo outside of /Users/pording/var/ to avoid the problem...

cc @timmywil

Member

mgol commented Jul 6, 2015

Hah, now it's obvious to me, thanks, @patrickording! So, the build system assumes that any file with /var/ in the path should be treated as variable declaration. Since you put the entire repo inside a such a directory, everything is treated this way which breaks.

This seems like a bug we should fix, we shouldn't be looking at places above the main repository directory. In the meantime, you can move the repo outside of /Users/pording/var/ to avoid the problem...

cc @timmywil

@mgol mgol added this to the 3.0.0 milestone Jul 6, 2015

@mgol mgol added the Build label Jul 6, 2015

@mgol mgol closed this Jul 6, 2015

@mgol mgol reopened this Jul 6, 2015

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Jul 6, 2015

Member

Ah, sure, we can fix that.

Member

timmywil commented Jul 6, 2015

Ah, sure, we can fix that.

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Jul 6, 2015

Member

Pretty cool bug though :-)

Member

markelog commented Jul 6, 2015

Pretty cool bug though :-)

@timmywil timmywil self-assigned this Jul 6, 2015

@patrickording

This comment has been minimized.

Show comment
Hide comment
@patrickording

patrickording Jul 7, 2015

Thank you everyone for helping me out! Keep up the awesome work!

Thank you everyone for helping me out! Keep up the awesome work!

@mgol mgol changed the title from Grunt build fails on Mac to Grunt build fails if repository folder path contains "/var/" Jul 8, 2015

@mgol mgol modified the milestones: 3.0.1, 3.0.0 Sep 14, 2015

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Sep 14, 2015

Member

I bumped the milestone to 3.0.1 as it's not critical and we still have work on 3.0.0.

Member

mgol commented Sep 14, 2015

I bumped the milestone to 3.0.1 as it's not critical and we still have work on 3.0.0.

@markelog markelog modified the milestones: 3.0.0, 3.0.1 Oct 12, 2015

markelog added a commit that referenced this issue Oct 12, 2015

Build: Fixed issue with base path that contain 'var'
Remove the cwd from the paths, so the regex doesn't kick in on "var"

Cherry-picked from 0c34e68
Fixes gh-2450
Closes gh-2641

@markelog markelog closed this in 0c34e68 Oct 12, 2015

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Oct 12, 2015

Member

@patrickording we landed a fix for it, would you mind testing it out?

Member

markelog commented Oct 12, 2015

@patrickording we landed a fix for it, would you mind testing it out?

@dmethvin dmethvin modified the milestones: 1.12/2.2, 3.0.0 Jan 7, 2016

@cssmagic cssmagic referenced this issue in cssmagic/ChangeLog May 18, 2016

Open

jQuery #5

@jquery jquery locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.