Comments (9)
Well, I put
"test": "echo %PATH%"
and run
npm test
but the path is just the original one. No node_modules.bin added
I'm using npm 1.1.0-beta-4
packed into node for windows 0.6.6
in this machine.
Ok, I just upgrade to the latest windows stable version
node v0.6.18
npm 1.1.21
and voila!
the echo %PATH% shows the local node_modules .bin added to PATH!!!
Thanks for your help. I used the old version node/npm for month, wo/major glitches. But with the new version, it's all ok!
(In Windows .msi (installation file), node AND npm are installed, together)
from json5.
npm test worked for me on Windows 7 using commit b511ff4 in branch develop. I had to run npm install first.
npm link was also not supported for me in Windows.
from json5.
I tried again, in another machine, now with Windows 7. Same issue (I ran npm install, to get mocha, in my first attempt, too). I got the last develop commit (the one mentioned by Max, now)
Apparently, it not recognize "mocha ... " as an executable.
I could run the test manually with
node test\via-eval.js
without glitches.
This is the npm log after npm test, if helps:
info it worked if it ends with ok
verbose cli [ 'C:\Program Files (x86)\nodejs\node.exe',
verbose cli 'C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js',
verbose cli 'test' ]
info using [email protected]
info using [email protected]
verbose config file C:\Users\angel.npmrc
verbose config file C:\Program Files (x86)\nodejs\etc\npmrc
verbose config file C:\Program Files (x86)\nodejs\node_modules\npm\npmrc
verbose caching D:\Git\json5\package.json
verbose loadDefaults [email protected]
verbose run-script [ 'pretest', 'test', 'posttest' ]
info pretest [email protected]
info test [email protected]
verbose unsafe-perm in lifecycle true
silly exec cmd "/c" "mocha --ui exports --reporter list"
silly spawning [ 'cmd',
silly spawning [ '/c', 'mocha --ui exports --reporter list' ],
silly spawning 'D:\Git\json5' ]
info [email protected] Failed to exec test script
ERR! [email protected] test: mocha --ui exports --reporter list
ERR! cmd "/c" "mocha --ui exports --reporter list"
failed with 1
ERR!
ERR! Failed at the [email protected] test script.
ERR! This is most likely a problem with the json5 package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR! mocha --ui exports --reporter list
ERR! You can get their info via:
ERR! npm owner ls json5
ERR! There is likely additional logging output above.
ERR!
ERR! System Windows_NT 6.1.7600
ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "test"
ERR! cwd D:\Git\json5
ERR! node -v v0.6.6
ERR! npm -v 1.1.0-beta-4
ERR! code ELIFECYCLE
ERR! message [email protected] test: mocha --ui exports --reporter list
ERR! message cmd "/c" "mocha --ui exports --reporter list"
failed with 1
verbose exit [ 1, true ]
from json5.
Thanks guys for raising this issue.
I wasn't aware that npm link
doesn't work on Windows; I'll update the documentation. (npm install
is actually all that's needed, but npm link
does that plus symlink it globally if you want to use it elsewhere. Not a requirement.)
@ajlopez, it's good to know that node test\via-eval
runs without a hitch, but that doesn't actually run the tests — it just defines them. It seems the problem is running Mocha.
Could you try running Mocha directly? Install it globally first via npm install -g mocha
, then run mocha --ui exports --reporter list
?
from json5.
Great!
npm install -g mocha
did the trick in my Windows 7 box!
I don't need npm link, yet. But I could emulate it (in other projects, to reference my local json5 project) using mklink Windows command (I guess)
from json5.
Great! But that made me realize what may be up -- Mocha was never installed locally, I'm guessing. If you run npm ls
in the project directory, does it show anything?
If not, just run npm install
(I updated the documentation to list this instead of npm link
), then npm should be able to find the local mocha
binary just fine. You can choose to npm uninstall -g mocha
if you like then.
from json5.
Mocha was installed locally, since my first attempt. But I don't know why it doesn't run from npm test.
I just run npm ls, and mocha is there.
I checked local node_modules, too.
All mocha is there.
Just to be sure, now I did:
npm uninstall -g mocha
npm test
and the issue was back: error, "mocha .... " was not recognized as executable.
A bit of research:
In windows, npm -g install the program at
\AppData\Roaming\npm
Mocha put mocha.cmd at that folder
The machine PATH has an item pointing to that folder (I guess it was put there by node installer for windows).
So, mocha is recognized as command from any folder.
But with local install of mocha, that mocha.cmd is at local node_modules.bin
I don't know if npm includes that local folder in a temporary PATH when it launches test scripts.
But apparently, it doesn't work in my machines.
When I run from local project folder:
node_modules.bin\mocha --ui exports --reporter list
it works (wo/global mocha install)
from json5.
Interesting. Npm is indeed supposed to include local binaries in the PATH when running scripts like npm test
.
Could you echo %PATH%
and see what it says? Could you also print the contents of node_modules\.bin
?
from json5.
Ah, that's awesome! Great to hear.
from json5.
Related Issues (20)
- Explain use cases front and center HOT 3
- Module '"node_modules/json5/lib/index"' has no default export HOT 1
- Support Integers outside the range `[-(2**53)+1, (2**53)-1]` HOT 6
- SyntaxError when require()ing JSON5 file in Jest test HOT 1
- Prototype Pollution in JSON5 HOT 11
- json5 latest is now 1.0.2 on npmjs - intentional? HOT 3
- Support Template Literals using backticks? HOT 1
- Provide `exports` config in `packages.json`
- Multiline JSON doesn't multiline HOT 1
- add key property support ? HOT 1
- Add `comma-dangle` option HOT 7
- Online JSON5 Editor(Formatter) is misleading? HOT 2
- Use .substring() instead of the deprecated .substr()
- Cannot stringify "\u0000"
- transitive dependency 'minimist' needs to be updated by rebuilding HOT 1
- question: commented unreachable code HOT 10
- JSON5.stringify() option: `trailingCommas` HOT 3
- Focus on ESNext HOT 1
- CLI should process consecutive JSONs HOT 1
- migrate to ESModules HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json5.